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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crontab problem

Status
Not open for further replies.

ukraine12

Technical User
Mar 21, 2001
45
0
0
US
i need to run a script via the crontab(no problem) but am having problems with passing parameters to it. in my script i use the getopts function to determine what to do with the parameters.
my crontab entry looks like
30 12 * * * /directory/script -abc >logfile 2>&1

if i run the script from the command line i have no problems. my parameters are needly handled by the script.
my script reads:

while getopts shbm name
do
case $name in
s) action;;
h) usage;;
b) action;;
m) action;;
esac
done

please assist.



 
Are you getting anything in logfile?

Columb Healy
 
Add the following line on top of your script for debugging purpose:
set -x

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
yes, i put a "set -xv" in my script and got

+ unset savesets
+ unset fstab
fstab=/etc/fstab
+ getopts sbhm name

and that is it. if i run the script via the command line i see every option being processed.
 
Is your login shell /bin/sh ?
What is the very 1st line of your script ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top