Trigger a script by consequtive scripts in crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trigger a script by consequtive scripts in crontab
# 1  
Old 12-04-2009
Trigger a script by consequtive scripts in crontab

Hello Friends,

I've been searching solutions for an exceptional backup case recently, I need someone to guide me, suggest a method pls.
In a production system we have backup scripts, they are run by cron one after another, and monthly. There is 1 hour difference between each consecutive script in crontab and we transfer data to a magnetic TAPE. Exceptional case happens when the following items occur at once:

1. TAPE is full (End-of-TAPE is reached) when one of backup script is running.
(The interrupted script -which is ufsdump process in script- waits until new TAPE is placed, it automatically detects replacement of new TAPE and continue the rest of process).

2. Alarms are not observed by system admin so they forget to replace a new TAPE until next script. It is time for next script to be run (current interrupted script is not completed yet). However queued crontab script cannot be run because TAPE is full, so one backup is missing as a result.

I would like to find out if i can trigger the script (which was not run on time) from inside next script? Adding some extra parts and checking output logs of ufsdump can i put extra control? There are special words like "attention,done,finished" in logs after interrupted "ufsdump" process is completed with placing new TAPE.

But what makes me confuse is that i do not know when new TAPE is placed? so you know i can not guess how many scripts will not run because of this so how many scripts will be triggered later Smilie

Advise me please

Regards
# 2  
Old 12-04-2009
It's a mess. Why put something in cron that requires attention by a human?
Sounds like an operations staff job.

At any rate, you could simply put all the jobs in one script, and then just have a little loop that checks the hour to make sure that it's been an hour since the previous one started.

something like:

punch_time_clock
backup_one

check_time
is time greater than equal to one hour?
Yes, continue
no, wait a minute and check again.

punch_time_clock
backup_two

etc...

pretty easy to put the whole thing in a ksh loop:

Code:
punch_time_clock

cat << EOF |
back_up_one
back_up_two
back_up_three
EOF
while read job ; do

  $job

  check_time
  while [[ $hour -eq $prev_hour ]]; then
    sleep 60
    check_time
  done

done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To trigger script on particular instance

Hi Guys, I have a main_script.sh which runs every day and scheduled in crontab. in the main script i read data from config file test.config apple mango orange main_script.sh for i in `cat test.config` do if then echo 'Apple' (3 Replies)
Discussion started by: Master_Mind
3 Replies

2. Shell Programming and Scripting

Multiple scripts in one single script - crontab

Hello all, Hope all's well. i'm not sure if this is possible but i have some scripts running in a crontab with different intervals, 1min, 5 min, etc. As for a "cleaner" and better control of these scripts (as by time we will have hundred's of scripts used for the same purpose, i.e for Nagios... (4 Replies)
Discussion started by: nms
4 Replies

3. Shell Programming and Scripting

Take backup of scripts listed in crontab

Hi, I'm trying to take backups of script files listed in cron tab but,my cron entry has value like this 10 3 * * * /usr/sbin/logadm 15 3 * * 0 /usr/lib/fs/nfs/nfsfind 30 3 * * * && /usr/lib/gss/gsscred_clean #10 3 * * * /usr/lib/krb5/kprop_script ___slave_kdcs___ 00,15,30,45 * * * *... (1 Reply)
Discussion started by: Sivarajan N
1 Replies

4. Shell Programming and Scripting

How to get cron (scripts in crontab) started?

Hi, I have a query related to UNIX Crontab scripts - Issue: Server space on the db server got 100% full as a result of which the cron scripts did not run. The space utilization issue got resolved in the afternoon. The crons scheduled for a time post the resolution caught up. However the... (1 Reply)
Discussion started by: qwerty000
1 Replies

5. Shell Programming and Scripting

Local script to trigger multiple remote scripts

Hi All, I am facing problem running a script which triggers another script in multiple remote servers. my script in my local server looks like below ssh server1 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null " ssh server2 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null "... (7 Replies)
Discussion started by: sain
7 Replies

6. UNIX for Dummies Questions & Answers

Help with Crontab and Scripts

I'm trying to create a crontab that runs every hour and runs a script in my $HOME/bin directory. Everytime it goes to run it I get this mail. Message 14: From root@xx.xxxx.edu Thu Apr 12 14:03:01 2012 Return-Path: <root@xx.xxxx.edu> X-Original-To: bbowers Delivered-To:... (4 Replies)
Discussion started by: bbowers
4 Replies

7. UNIX for Dummies Questions & Answers

Deleted the scripts in Crontab by mistake

hi, instead of typing crontab -e i gave crontab -r and hit enter. So i lost all my scripts. Is there any way to restore the deleted scripts? Please help me out Thanks Ajay (3 Replies)
Discussion started by: ajayakunuri
3 Replies

8. Shell Programming and Scripting

Scripts not nunning in CRONTAB

hi, i need to run one script in cron... in that script has connect antoher server and doing sftp for file transfer to another script. and going to be run another script in another server ssh ravikus\@server2 /export/home/ravikus/scripts/GetDetailsC2b.sh it is work fine when i run... (6 Replies)
Discussion started by: rsivasan
6 Replies

9. Shell Programming and Scripting

Crontab PHP scripts not ending

when i run the scripts from command line like php ./file.php they run fine and it ends. But i have them running in crontab every 5 minutes and they sometimes dont close. Can i write something to log why or force them to close after a certain amount of time by killing the pid? (2 Replies)
Discussion started by: nitrous
2 Replies

10. UNIX Desktop Questions & Answers

audit to crontab scripts

hi, I have scripts which are running every 3 minutes. The scripts include connection to a database, using sqlplus. Sometimes, the connection fails (invalid username or password, locked user etc..) and the connection returns the error code, to the unix screen or to a file. I want whenever there's... (2 Replies)
Discussion started by: krem
2 Replies
Login or Register to Ask a Question