![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please send activation mail.. | bvijaycom | Forum Support Area for Unregistered Users & Account Problems | 1 | 05-19-2008 05:18 AM |
| Activation | jamalwil7 | Forum Support Area for Unregistered Users & Account Problems | 0 | 05-15-2008 04:20 PM |
| Account Activation Problem | MIKU | Forum Support Area for Unregistered Users & Account Problems | 1 | 08-09-2007 06:17 AM |
| Did not receive activation mail | pl_cyber | Forum Support Area for Unregistered Users & Account Problems | 0 | 05-30-2007 12:09 AM |
| Wireless ipw2200 activation | XinU* | UNIX for Advanced & Expert Users | 4 | 01-21-2007 01:25 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Cronjob Activation
Hi All,
I have set a cronjob to run a script at a frequency of 10 mins. However, if the script takes more than 10 mins to complete, how will the cronjob behaves? 1) Does it ignore the current process and restart the whole process again? 2) Or does it stop to trigger the script again unless previous process has been completed? |
|
||||
|
Quote:
Hi, Running the script continously means to say that i have to leave a command prompt window always open. Once closed, the process will be ended, and also another disadvantage is that a infinite looping script will eat up alot of resources, wouldn;t it ? So i still think cron is the more practical one. But i have no idea about anacron or control-m. Can you enlightened me on that ? Can you give an example of script being re-entrant ? I was thinking if i could make the script check for the process to see if the previous process have been completed, can any experts give me some examples of this ? I am using csh by the way. |
|
|||||
|
Quote:
Quote:
Your call of course. Quote:
Control-M is a BMC product that manages scheduling at an enterprise level, it supports job dependancies, understands limited resources and works across multiple platforms. Costs a bit. Google for more info on these Reentrant just means that it can be run multiple times at once without going wonky. One example: Not rentrant: Code:
#!/bin/sh /usr/bin/do_some_stuff > /var/log/did_some_stuff.log do some other things if grep 'it worked' /var/log/did_some_stuff.log then /usr/sbin/assume_we_are_good_to_go else echo "Argh" fi Code:
#!/bin/sh /usr/bin/do_some_stuff > /var/log/did_some_stuff.$$.log do some other things if grep 'it worked' /var/log/did_some_stuff.$$.log then /usr/sbin/assume_we_are_good_to_go else echo "Argh" fi rm /var/log/did_some_stuff.$$.log Another, simpler, way is to just look in the process table for another copy of the script, if found exit immediatly. Quote:
Code:
#!/bin/csh
set numprocs=`ps -ef | grep -v grep | grep $scriptname | wc -l | awk '{ print $1 }'`
if ($numprocs == 1) then
# carry on
else
echo "Another instance is already running, exiting..."
exit 0
endif
|
|
||||
|
Hi ,
I am refering to this particular exmaple that you have provided me. Code:
#!/bin/csh
set numprocs=`ps -ef | grep -v grep | grep $scriptname | wc -l | awk '{ print $1 }'`
if ($numprocs == 1) then
# carry on
else
echo "Another instance is already running, exiting..."
exit 0
endif
If it equals to 1 , why does it show that the script is not running anymore? I tried a simple csh script below and it doesn;t really work. When it is sleeping, the name of the script which is "myscriptname" is not reflected during " ps -ef ", it only shows " usr 28951 28941 0 15:00:39 pts/7 0:00 sleep 100 ". Can you help ? Code:
#!/bin/csh echo xxx echo ppp echo zzz sleep 100 |
|
|||||
|
Quote:
Works for me, when I run a csh script with a sleep in it, I see the sleep, _and_ the main script running. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|