Sponsored Content
Top Forums Shell Programming and Scripting small error in shellscripting -archival part Post 302564529 by aish11 on Thursday 13th of October 2011 11:58:10 PM
Old 10-14-2011
small error in shellscripting -archival part

Hi All,

I have run the below script but getting one small error. please help me to solve this.

ERROR:
Code:
tar: Error exit delayed from previous errors

CODE:
Code:
#! /bin/bash
CEP=/home/user01/exercise/CEP
ARCH=/home/user01/exercise/archive
LOG=/home/user01/exercise/logs
#################### initialization
# Archival date
if [ `date +%a` = "Mon" ]; then
        let arc_date=`date +%Y%m%d --date='3 days ago'` # friday
else
        let arc_date=`date +%Y%m%d --date='yesterday'`
fi
#################### archive previous files
mkdir -p $ARCH/$arc_date
if [ "$?" -eq "0" ]; then
        tar -Pczf $ARCH/${arc_date}/${arc_date}.tgz $LOG/*.log $CEP/*.log.* $CEP/Adapter/*.csv $CEP/*.csv
rm -rf $LOG/*.log
rm -rf $CEP/*.csv
rm -rf $CEP/*.log.*
rm -rf $CEP/Adapter/*.csv
fi


Thanks
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Archival Tool for UNIX

Hi All, Need to get the information if there is any tool on Unix for Archiving and retrival of documents automatically. Having the capbalilty to integrate with other systems. And provide the APIs which can be called from other Systems to facilitate automatic Archival and Retrieval. Thanks &... (7 Replies)
Discussion started by: sanjeev0915
7 Replies

2. Shell Programming and Scripting

shellscripting question

I have been “commissioned” to write a shellscript to automate Oracle cold refeshes.. right now we perform about 20 refresh each 300gb in size which takes up our time. my goal is to write a shellscript which can be executed by a user on serverA to refresh any of the 7 databases on ServerA. I am... (4 Replies)
Discussion started by: jigarlakhani
4 Replies

3. Shell Programming and Scripting

Shell - a small error! :(

# doloadsfs.sh - load scribe data into new SFS files for s in c e f h m do for f in 0001 0002 0003 0004 do hed -n ma$s.$f.sfs slink -isp -f 20000 c:/data/scribe/scribe/dr1/mt/ma$s/a${s}pa$f.pes \ ma$s.$f.sfs anload... (8 Replies)
Discussion started by: abrox
8 Replies

4. Shell Programming and Scripting

New to shellscripting....need some help!

I have 3 shell scripts below.... I need to write a command line parser for these 3 utilities. basically the parser will accept ANY number of commands in this syntax -r = right -f = findtext -c = count so you do something like mu.s -r 3 4 5 -f hello goodbye.txt -c *.c -h 5 4 3 right... (5 Replies)
Discussion started by: TurboArkhan
5 Replies

5. Shell Programming and Scripting

New to shellscripting error: ./emailnotifications.sh: line 43: [: FH: integer expression expected

Hi , I'm a beginner in unix shell scripting need help in rectifying an error Source file :test.txt with Header ------ ----- Trailer ex: FH201010250030170000000000000000 abc def jke abr ded etf FE2 I was validating whether the header begin... (2 Replies)
Discussion started by: dudd9
2 Replies

6. Shell Programming and Scripting

Timeout in shellscripting

#!/bin/sh for ip in $(cat /root/Desktop/ftp.txt) do HOST=$ip USER='bob' PASS='bob' ftp -n $HOST <<EOF user bob bob EOF echo "$ip" done the Above code i want to use check and verify login works on multiple ftp servers on my network. However the ftp servers are dynamic in setup... (5 Replies)
Discussion started by: Noledge
5 Replies

7. Shell Programming and Scripting

Small Error while copying

Hello Gurus, I am getting an error when i am running the below script: # cat test #!/bin/bash ti=/home ls -1rt /home/jinny/html > /tmp/apafiles xargs cp -R -t $ti/ji < /tmp/apafiles cp: cannot stat `smscconf_lra.html': No such file or directory cp: cannot stat... (3 Replies)
Discussion started by: hitesh1907
3 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Help -file archival

Hi All, I have a scenario to append all the CSV files with date while moving from one directory to another directory . e.g. Source DIR - A files (can be more files, not sure about file names , but csv format ) a.csv, bc.csv, el.csv,... Target Dir - B I want my file names as ... (16 Replies)
Discussion started by: AspiringD
16 Replies

9. Shell Programming and Scripting

Shellscripting -z option

Can someone explain the -z option in shellscripting. I did this. When I was in both ksh and bash it echoed back hi. #!/bin/ksh if then echo hi fi When I echoed $BASH_VERSION in bash it gave a version. When I echoed $BASH_VERSION in ksh it was blank. I thought -z was... (4 Replies)
Discussion started by: cokedude
4 Replies
NPM-RUN-SCRIPT(1)                                                                                                                NPM-RUN-SCRIPT(1)

NAME
npm-run-script - Run arbitrary package scripts SYNOPSIS
npm run-script <command> [--silent] [-- <args>...] alias: npm run DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. As of ` https://blog.npmjs.org/post/98131109725/npm-2-0-0, you can use custom arguments when executing scripts. The special option -- is used by getopt https://goo.gl/KxMmtG to delimit the end of the options. npm will pass all the arguments after the -- directly to your script: npm run test -- --grep="pattern" The arguments will only be passed to the script specified after npm run and not to any pre or post script. The env script is a special built-in command that can be used to list environment variables that will be available to the script at run- time. If an "env" command is defined in your package, it will take precedence over the built-in. In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write: "scripts": {"test": "tap test/*.js"} instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests. The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of ` https://github.com/npm/npm/releases/tag/v5.1.0 you can customize the shell with the script-shell configuration. Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full path you were in when you ran npm run. npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten. You can use the --silent flag to prevent showing npm ERR! output on error. You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. SEE ALSO
o npm help 7 scripts o npm help test o npm help start o npm help restart o npm help stop o npm help 7 config January 2019 NPM-RUN-SCRIPT(1)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy