Question : Using IF/THEN in the crontab or converting an IF/THEN statement to work in the crontab

I need to know how to translate an IF/THEN statement that works fine in any shell (BASH, SH, CSH...ect) into something that is understandable by the crontab. This is going to be used to run dozens of complicated scrips and cannot be hardcoded into each script.

if [ `/opt/VRTSvcs/bin/hagrp -state ClusterService -sys paupcl01` == "ONLINE" ]; then
 $dosomething$
fi

thanks!!!

Answer : Using IF/THEN in the crontab or converting an IF/THEN statement to work in the crontab

You could also write it as

[ `/opt/VRTSvcs/bin/hagrp -state ClusterService -sys paupcl01` = "ONLINE" ] && $dosomething$

Random Solutions  
 
programming4us programming4us