LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 07-22-2009, 10:11 AM   #1
esuradi
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
Cron Job


Hello All ;

I have issued a script that doing bunch of things and save the results on many files through redirecting the output during the runtime of the script itself, where the files that contains the results are usually saved in the same directory of the script.

my quastion is : is it possible to make a cron job that do run that script automaticlly ? as i tried to do that but it didn't. as i also noticed that from the cron log it seems that my script is being run from cron but no reult are generated or files created .

Please advice.
 
Old 07-22-2009, 10:14 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Make sure the script has the full path to all the commands
eq
/bin/rm
/usr/bin/rsync
etc
 
Old 07-22-2009, 11:22 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
As suggested by repo, use full paths of both the commands and the files in your script. Also check the crontab owner's mail to look for messages from the script execution. Standard output and standard error not redirected to a file are sent to the owner's mail by default. In alternative you can explicitly redirect stdout and stderr to a file and check it after the job execution:
Code:
5 8 * * * /path/to/script.sh > $HOME/cron.log 2>&1
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron job somsahi Linux - Software 9 10-05-2006 03:19 PM
Cron job rust8y Linux - Newbie 3 05-18-2006 10:06 AM
cron job wbatzle Linux - Newbie 2 07-12-2005 05:19 PM
cron job? dr_zayus69 Linux - Newbie 14 12-01-2004 07:16 PM


All times are GMT -5. The time now is 11:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration