how to capture my app starting up.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to capture my app starting up.
# 1  
Old 01-04-2008
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

Smilie
# 2  
Old 01-04-2008
First of all, I despise the "tee $LOGFILE" nonsense. Batch scripts should be logged in their entirety, which I discussed here:

https://www.unix.com/shell-programmin...#post302148874

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).
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Wuhan Coronavirus Status App for China - Rapid Prototype using MQTT and the IoT OnOff IOS App

With a little bit of work, was able to build a nice "Wuhan Coronavirus Status" app using MQTT and the IoT-OnOff app. More on this technique here: ESP32 (ESP-WROOM-32) as an MQTT Client Subscribed to Linux Server Load Average Messages The result turned out nice, I think. I like the look and... (10 Replies)
Discussion started by: Neo
10 Replies

2. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

3. Shell Programming and Scripting

error situation handling when starting app from a script

Hi, in my bash script I start 3rd party app that runs quickly normally and returns some data that I use later for processing. However if there are problems the app doesn't return anything and just hangs... then my script also hangs of course, awaiting for the app to comeback. Was wondering how to... (3 Replies)
Discussion started by: TomSu
3 Replies

4. Red Hat

userid with nothing to do on the os/app

Hi All, I got this userid apache with the same userid and groupid and /sbin/nologin and the /www/a home folder is empty. Can I just delete this userid? How can I investigate if userid have something to do with the application? Thanks for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

5. HP-UX

help auto starting app on boot

Hi I need a bit of help figuring out how to auto start an application on boot on an HPUX. I am a fairly exp AIX guy now working an HP shop. I use to change a /etc/rc... file. Any advise would be a great help TIA. –K If it is a help the program is a DB and runs as root /usr/ud{##}/startud... (3 Replies)
Discussion started by: KmJohnson
3 Replies

6. Solaris

luminis app

The guys at SunGard want to charge a lot of $$$$ for installing Luminis and we are trying to see if this can be done without them. Their installation guide provided page #53 ( http://www.luminis.nocccd.edu/documents/Luminis%20IV/lp40000in.pdf ) doesn't really tell you much. All they say is that... (4 Replies)
Discussion started by: ceci1
4 Replies

7. Programming

Deadlocked App

Hello All - We have a legacy C program running non stop on one of our servers, with several instances often running at once. Fairly regularly, one of the instances while stop outputting to the log file and will just deadlock/hang. They must be then 'kill'ed by myself. When I gdb into one of... (3 Replies)
Discussion started by: markanderson
3 Replies

8. Shell Programming and Scripting

capture the process id when starting a background process

Hello all, How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename. Any assistance is most appreciated. Thanks, Jim... (10 Replies)
Discussion started by: jleavitt
10 Replies
Login or Register to Ask a Question