LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-22-2011, 07:14 AM   #1
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Rep: Reputation: 16
cronjob did not run


Does anybody see anything wrong with this cronjob
Should I put something in quotes.

I did not run - and I just installed the mail utility (cron seems to send its error messages)

Code:
00 01 * * 1-5 /usr/bin/scp casper@192.168.60.17:/data/binary/filetoTransfer.txt casper@192.168.81.95:/home/casper/
i am careful to put the path to the job in cronjob.
I just want to send something from one remote host to another.
 
Old 12-22-2011, 07:34 AM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 119

Rep: Reputation: 26
1. Do you have other jobs in cron that are running OK?

2. What happens when you run this job from the command line?
 
Old 12-22-2011, 07:36 AM   #3
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
i actually do not have any other crons running - i will test one

this runs just fine from the command line
 
Old 12-22-2011, 07:43 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
crontab is running ?
Do you use this crontab as user 'casper'
(do crontab -l when logged as casper to verify)
 
Old 12-22-2011, 07:46 AM   #5
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
casper@casperdesktop:~$ ps auxwww | grep cron
root 937 0.0 0.0 2376 856 ? Ss Nov17 0:02 cron
casper 26336 0.0 0.0 3328 912 pts/43 S+ 08:47 0:00 grep --color=auto cron
 
Old 12-22-2011, 07:47 AM   #6
mmaki
Member
 
Registered: Nov 2005
Location: Thousand Oaks, CA
Distribution: Debian
Posts: 33

Rep: Reputation: 15
Are you using SSH keys to make the connection between hosts or does it prompt you for a password if this is run at the command line? Without SSH keys it will not run from cron.
 
Old 12-22-2011, 07:48 AM   #7
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
keys are loaded - i can run the command from the line with out issue
 
Old 12-22-2011, 08:17 AM   #8
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Anything from the cron log, e.g. /var/log/cron or /var/log/message? Did you receive a mail from the cron daemon?
 
Old 12-22-2011, 08:23 AM   #9
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
I just installed the mail utility - nothing in either of those error logs

sudo apt-get install mailutils

Last edited by casperdaghost; 12-22-2011 at 08:30 AM.
 
Old 12-22-2011, 08:26 AM   #10
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
Do you use this crontab as user 'casper' ?
(verify with crontab -l in casper session)
 
Old 12-22-2011, 08:53 AM   #11
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Quote:
Originally Posted by casperdaghost View Post
I just installed the mail utility - nothing in either of those error logs
So you need to wait for 1:00 AM to see if something comes out or are you testing the crontab in real time?

Indeed nothing in the logs means that the cron job didn't run at all, as you've anticipated in your first post. Otherwise you should see something like
Code:
Dec 22  1:00:01 localhost CROND[17764]: (casper) CMD (/usr/bin/scp casper@192.168.60.17:/data/binary/filetoTransfer.txt casper@192.168.81.95:/home/casper/)
in /var/log/cron. If this is the case, you have to investigate the proper functioning of the cron daemon. Hence the checklist:

1. Which Linux OS are you running on?
2. Which version of the cron daemon is installed?
3. Is the cron service enabled?
4. Did you successfully run a job in the past, using the casper's crontab?
5. Is the user casper allowed to use crontab (check /etc/cron.allow and /etc/cron.deny)?
 
Old 12-22-2011, 09:16 AM   #12
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
it seems that cron is running as root - not casper

casper@casperbox:~$ ps auxwww | grep cron
root 937 0.0 0.0 2376 856 ? Ss Nov17 0:02 cron
casper 26766 0.0 0.0 3328 908 pts/270 S+ 10:15 0:00 grep --color=auto cron
walt@casperbox:~$ sudo service cron restart
[sudo] password for casper:
cron start/running, process 26772
casper@casperbox:~$ ps auxwww | grep cron
root 26772 0.0 0.0 2376 900 ? Ss 10:15 0:00 cron

just tried a test cron and it did not execute
10 13 * * 1-5 /usr/bin/xmessage -file /home/casper/checkCron
 
Old 12-22-2011, 09:26 AM   #13
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
Code:
http://unixgeeks.org/security/newbie/unix/cron-1.html

If there is neither a cron.allow nor a cron.deny file, then the use of cron
is unrestricted (i.e. every user can use it).
there is not an allow or deny file in the etc directory
 
Old 12-22-2011, 09:36 AM   #14
casperdaghost
Member
 
Registered: Aug 2009
Posts: 346

Original Poster
Rep: Reputation: 16
I am running on ubuntu

casper@casperbox:~$ sudo service cron restart
[sudo] password for walt:
Sorry, try again.
[sudo] password for walt:
cron start/running, process 26974
casper@casperbox:~$
 
Old 12-22-2011, 10:08 AM   #15
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 119

Rep: Reputation: 26
Can you run a cron entry as root (from the root crontab)?

Have you checked this page https://help.ubuntu.com/community/CronHowto? It lists a couple reasons, such as no trailing newline in the crontab file, or a user not in /etc/shadow that could cause the job not to run.
 
  


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
[SOLVED] Cronjob to run every other weekday linuxguy7820 Linux - Newbie 2 10-27-2011 01:38 PM
run cronjob once every three months noir911 Linux - Server 2 04-30-2010 03:30 PM
cronjob to run every 15 minutes? your_shadow03 Linux - Newbie 5 11-19-2009 10:58 PM
[SOLVED] make cronjob run every 10mins qwertyjjj Linux - Newbie 2 08-13-2009 08:06 PM
why do these cronjob not run? SheldonPlankton Linux - General 1 01-05-2005 08:01 PM


All times are GMT -5. The time now is 03:11 AM.

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