crontab condition

hi
i have one crontab file. In crontab file i want to write a if condition is it possible by any ways.

suppose on 22.00 .. i want to run test.sh file. but only when the flag in a outer file bust.txt is 1 otherwise dont execute. same.

can we use conditions in crontab file.?

Thank you.
Regards,
Swapneel

Hi Swapneel

At the chosen time. run a script which contains the if condition. it will have the desired effect and will also make the crontab file easier to read.

Cheers
Helen

Hi helen

i got wht you r saying. See i have more than 100 of important scripts running on different time and date..... I need to modify each and every script to add this if condition/ clause.

instead of modifying all these files.. i m thinking to write a condition in crontab file. is it ok?or is it possible?can we write condition in cron tab file?

see unix is going to store all these scripts and there sheduled time. in any case is it possible to manage it in crontab file. see i cant update all of my calling scripts.

thanks a lot helen!

Best Regards,
Swapneel

0 22 * * * read a < bust.txt && [ $a -eq 1 ] && test.sh

Hi

Its working fine.
Thanks a lot Gunnies Mind.

Regards,
Swapneel

Hi.. all
I have got 3 scripts: s1.sh, s2.sh, s3.sh
I want to run s1 at 15,30,45 mins of every hr.
s2.sh should run 10 mins after s1.sh has been executed.
s3.sh should run 10 mins after s2.sh has been executed.

Given the above case, wt approach shd be follwd. plz explain in detail (naive to Shell Prog)

Why not make the "trigger-condition" part of the script itself?

I don't know if a crontab is the right place for this. Of course it could be done, you can enter individual shellcommands in a crontab, so why not an if-then condition, but this makes things so much more complicated.
Keep all your logic in one place (script) and put the scheduling where it belongs (crontab).

Just my $0.02

Edit: Oops, didn't read the part where you have 100 scripts that you need to run. Why not use an overall-startscript that runs the other scripts? You can put your condition there...