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!

Cron is driving me crazy!

Status
Not open for further replies.

StickyBit

Technical User
Jan 4, 2002
264
0
0
CA
I'm trying to cron a perl script on my solaris 8 server and I'm having problems?

Question 1.
should I cron the script as root or a different user?

Question 2.
I created a different user and submitted the following cron job. crontab mycronfile

contents of mycronfile: 2 0 * * * /usr/local/dhcp/dhcp.pl &

I received the following email from cron as root:

Your "cron" job on sticky.internal.com
/usr/local/dhcp/dhcp.pl &

produced the following output:

sh: /usr/local/dhcp/dhcp.pl: cannot execute.

From the amount of e-mail’s received, I think the cron syntax is wrong among other things; I need the script to run every 2 min. What am I doing wrong?

StickyBit.

 
If you tried to execute /usr/local/dhcp/dhcp.pl on the command line you would still get an error. I think what you're looking for is:

2 0 * * * /usr/bin/perl /usr/local/dhcp/dhcp.pl

/usr/bin/perl may not be the path to your perl executable, adjust accordingly (check with "which perl").
I don't believe the & is necessary at the end because it is a cron job.

Let us know how it goes!
630111
 
I have found the problem. It was with the permissions on the script; only root could execute. However, what would the syntax be to cron the script exery 2 min. Still trying to figure this one out.

Thanks for all your help,


StickyBit.
 
you would have to put in an entry for each minute that you want it to run. 2,4,6,8,10,12.........etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top