![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Capture scp output | Tornado | Shell Programming and Scripting | 7 | 12-06-2007 06:16 PM |
| capture the ouput! | azmathshaikh | Shell Programming and Scripting | 0 | 12-20-2005 03:23 AM |
| Red Hat - ouput capture | juxtaman | UNIX for Dummies Questions & Answers | 3 | 04-10-2003 07:31 AM |
| screen capture | merlin | UNIX for Dummies Questions & Answers | 10 | 02-10-2003 10:45 AM |
| capture the process id when starting a background process | jleavitt | Shell Programming and Scripting | 10 | 04-04-2002 05:04 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
how to capture my app starting up.
This is the script for the cold backup that we get from mycat every time it goes down and up again.
It’s a huge email that we get and all within the body. Here is the dilemma; I would like to capture just the “”successful start up of the luminis app.”” I don’t know if I need to do an “if statement “ or just get rid of the | tee –a $LOGFILE. This back up script is running out of a cronjob once a week for the cold backup. So what I was thinking was to take out all of the | tee –a $LOGFILE statements except for the last statement for the starting of luminis, that way it would solve me getting the email on the body filled with the whole process as you can see in the script bellow. Once a week I get this huge email. I want it to make sure that the backup happens, the logs get written, but that the email that I get only shows whether the startup of the application called luminis has started or failed. So what to do? See the script bellow;;;;; ################################ # shutdown luminis ################################ /etc/init.d/luminis stop STATUS=$? echo "[`date`] CP Shutdown status = $STATUS" | tee -a $LOGFILE sleep 60 echo 'Starting Luminis Backup Process...' #change the backup directory from what's setup in .cprc for the cold backups. LUMINIS_BACKUPS=/cpbackup-cold export LUMINIS_BACKUPS LOGFILE=$LUMINIS_BACKUPS/luminis_cold_backup`date +%y%m%d`.log TARFILE=$LUMINIS_BACKUPS/luminis_cold_backup`date +%y%m%d`.tar # ################################ # Start Backup ################################ # echo 'TIMESTAMP: '`date` | tee -a $LOGFILE # ############################### # Backup CP_ROOT directory ############################## # echo 'Backing up luminis (CP_ROOT) directory...' | tee -a $LOGFILE cd /opt tar -cvf $TARFILE luminis | tee -a $LOGFILE # ################################ # Compress tar file ################################ # echo 'Compressing tar file' | tee -a $LOGFILE gzip -vf $TARFILE | tee -a $LOGFILE find $LUMINIS_BACKUPS -mtime +31 -type f -exec rm \{\} \; ################################ # startup luminis ################################ /etc/init.d/luminis start echo 'TIMESTAMP: '`date` | tee -a $LOGFILE |
| Forum Sponsor | ||
|
|
|
|||
|
First of all, I despise the "tee $LOGFILE" nonsense. Batch scripts should be logged in their entirety, which I discussed here:
Help in background process Nevertheless, I don't see a mail command in this script? I guess stdout from the cron job is mailed to the owner. You should probably add an explicit "echo OK | mail admin" type of command at then end of the script, but send all the output to a logfile (as I demonstrate in the link above). |
|||
| Google UNIX.COM |