determine if crontable line should have been executed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers determine if crontable line should have been executed
# 1  
Old 12-22-2007
determine if crontable line should have been executed

Hi there,

Is there a command in UNIX that could determine if the line in a crontable should be executed or not? Just as if the command is the crontab command itself. Say I have this crontable file:

10 10 * * * /usr/bin/script1.sh
20 11 * * * /usr/bin/script2.sh
30 12 * * 2 /usr/bin/script3.sh
40 13 * * 3 /usr/bin/script4.sh

And say today is Tuesday 12:45:00, this command can tell when I ran it that line one, two and three should be running already. Or if today is Sunday 10:11 this command can tell me that line one should have run already?
# 2  
Old 12-22-2007
Suggestively ....
Code:
10 10 * * * /usr/bin/script1.sh  >> $CRONLOG/script1.clog
20 11 * * * /usr/bin/script2.sh  >> $CRONLOG/script2.clog
30 12 * * 2 /usr/bin/script3.sh  >> $CRONLOG/script3.clog
40 13 * * 3 /usr/bin/script4.sh  >> $CRONLOG/script4.clog

Then do `ls -altr $CRONLOG/script[1-4].clog` and check the date/time stamps.

Hope that helps some.

Cheers,
Cameron
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Another one line command where I'd like to determine if Ubuntu or Red Hat when running command

Hello Forum, I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies

2. Shell Programming and Scripting

Script is not getting executed

Hi All, I have written a programme where i need to work in one session but when that session get executed it doesnt execute other programme till I write exit. Below is the script #!/bin/bash echo 'Going to start' exectrusteduser.com sh.com cd /UAT_Logs/CDCI_LOGS/SEEDADM pwd echo... (6 Replies)
Discussion started by: ripudaman.singh
6 Replies

3. Shell Programming and Scripting

If condition - else is never executed

In the following code snippet, 'if' part is always executed irrespective of whether I enter 'y' or 'n'. I am unable to figure out my mistake even after spending couple of hours. Can someone point out the mistake? Thank you! echo "Do you want to delete?(y/n):" read USERINPUT echo $USERINPUT ... (2 Replies)
Discussion started by: Madhus
2 Replies

4. Shell Programming and Scripting

Pass awk field to a command line executed within awk

Hi, I am trying to pass awk field to a command line executed within awk (need to convert a timestamp into formatted date). All my attempts failed this far. Here's an example. It works fine with timestamp hard-codded into the command echo "1381653229 something" |awk 'BEGIN{cmd="date -d... (4 Replies)
Discussion started by: tuxer
4 Replies

5. Shell Programming and Scripting

Command is executed twice

Hi I try to run a command using bash script. The script should now look like this: #!/bin/bash case "$1" in start) sudo su - cispmgm -c "/usr/local/jdk/bin/java -Dworking.dir=/opt/ibm/cisp -Denvironment.target= -Xms512M -Xmx1024M -classpath... (3 Replies)
Discussion started by: nikolai.straess
3 Replies

6. AIX

Script not getting executed via cron but executes when executed manually.

Hi Script not getting executed via cron but executes successfully when executed manually. Please assist cbspsap01(appuser) /app/scripts > cat restart.sh #!/bin/ksh cd /app/bin date >>logfile.out echo "Restart has been started....." >>logfile.out date >>logfile.out initfnsw -y restart... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

7. Shell Programming and Scripting

ifdown not executed

I have a binary that runs ifdown (to bring down wireless interface). When i run it from php, it is not being run. Is it because the Apache server (php) is run as non-root user? Need Help! :confused: How can i fix this problem? (1 Reply)
Discussion started by: xerox
1 Replies

8. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

9. Shell Programming and Scripting

How to get the return code of subroutines executed as standalone as command line in Perl ?

How to do I get the return code of a subroutine in a perl module if invoke the subroutine as standalone, I have an module say TestExit.pm and in that i have a subroutine say myTest() which is returns 12, if i were to call the subroutine from command line like CASE:1 ( Without an explict... (2 Replies)
Discussion started by: ennstate
2 Replies

10. Shell Programming and Scripting

how to determine last line in a while do loop

Hey guy, I have a very simple question, I have the following script, while read $test do echo "this is $test" done < /testfile What I want is instead of printing "this is $test" for each line, I want the script to print out "this is last line" for last line, how should I do it? (10 Replies)
Discussion started by: fedora
10 Replies
Login or Register to Ask a Question