Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF Then in crontab

Status
Not open for further replies.

czarj

Technical User
Apr 22, 2004
130
US
I need to know how to translate an IF/THEN statemenr that works fine in any shell 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!!!


--- You must not fight too often with one enemy, or you will teach him all your tricks of war.
 
Code:
[ `opt/VRTSvcs/bin/hagrp -state ClusterService -sys paupcl01` == "ONLINE" ] && dosomething


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
in ksh, string comparison is just one '='

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




HTH,

p5wizard
 
Thanks, That worked!

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

--- You must not fight too often with one enemy, or you will teach him all your tricks of war.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top