Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Programming & Scripting
Reload this Page Need help with setting up crontab in FreeBSD
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Programming & Scripting C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Reply
 
Thread Tools Display Modes
Old 06-20-2008   #1 (permalink)
technossomy
Linux User
 
Join Date: Dec 2004
Posts: 286
Need help with setting up crontab in FreeBSD

I have the following line in crontab:
Code:
0 0,6,12,18 * * * * /usr/home/userid/script.sh > /usr/home/userid/script.log
This script does a curl on a webpage and writes it to disk by appending a timestamp to the filename. If I look in the /var/log/cron however, it appears that this cron job has never run. The only way to invoke the script.sh script is manually.
Is there a reason why this cron job does not run? Could it be a permissioning issue?
technossomy is offline   Reply With Quote
Old 06-21-2008   #2 (permalink)
objuan
Linux Newbie
 
objuan's Avatar
 
Join Date: Jul 2006
Location: california
Posts: 217
Hello
Your syntax looks right for the cron. Here is a quick test you can add to your crontab to see if it is working. First make a dir called test in /home
*/5 * * * * /bin/date >> /home/test/date

if the cron runs this test but not your syntax it is probilly a permissions
problem. Then just add your syntax to the root crontab and run it from there.

Hope this helps you out
objuan is offline   Reply With Quote
Old 06-23-2008   #3 (permalink)
technossomy
Linux User
 
Join Date: Dec 2004
Posts: 286
Thanks, that worked:
- script.sh does not work from the crontab, only through a manual invoke does it work
- date cron does work as intended.

So that means the permissioning issue remains? What do you mean by "Then just add your syntax to the root crontab and run it from there." ?

Thanks in advance
technossomy is offline   Reply With Quote
Old 06-23-2008   #4 (permalink)
objuan
Linux Newbie
 
objuan's Avatar
 
Join Date: Jul 2006
Location: california
Posts: 217
There is a users crontab and a root user crontab
at the command line type su
password for root , then as root type crontab -e
objuan is offline   Reply With Quote
Old 06-23-2008   #5 (permalink)
technossomy
Linux User
 
Join Date: Dec 2004
Posts: 286
Thanks again for your response. The crontab is set up for root only and contains both statements:
Code:
0 0,6,12,18 * * * * /usr/home/userid/script.sh > /usr/home/userid/script.log
*/5 * * * * /bin/date > /home/test/date
The file script.sh has rights as follows: -rwxr-xr-x
which I think should suffice.

What else could be wrong?
technossomy is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 02:21 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0