Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying cron in a Ubuntu VPS with a minimal install, so I had to run apt-get install cron. However, say I run crontab -e and add (as root) the following line:

* * * * * date >> /root/datelog

I get the success notification:

crontab: installing new crontab

but /root/datelog is never created. If I try start cron I get:

start: Job is already running: cron

On the other hand, ps doesn't yield anything:

# ps -ef|grep cron
root      3087 10498  0 Mar17 pts/24   00:00:00 grep --color=auto cron
root     29081  7863  0 Mar13 pts/8    00:00:00 man crontab

Any thoughts? Thanks!

Edit: Following ImaginaryRobots' suggestion, I have modified my crontab as follows... to no avail.

* * * * * date >> /root/datelog
* * * * * date >> /tmp/datelog
* * * * * /bin/date >> /root/bindatelog
* * * * * /bin/date >> /tmp/bindatelog

I.e., no such files appear either in /root or in /tmp.

Edit 2: Maybe I should mention that Ubuntu 12.04 (or at least this VPS) is giving me what I consider to be a well-known bug upon apt-get upgrade:

mount: permission denied
dpkg: error processing initscripts (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initscripts
E: Sub-process /usr/bin/dpkg returned an error code (1)

Packages install apparently with no problems. But this may be affecting the behavior of the system after all...

share|improve this question
    
Are you installing that cron as root? It may be a permission issue with the file you are trying to create. –  LnxSlck Aug 16 '12 at 16:55
    
Yes, I'm trying everything as root. (Have a bad tendency in that sense...) –  sadpluto Aug 16 '12 at 17:13
    
can you paste the output of the following? pgrep 'cron' –  ImaginaryRobots Aug 16 '12 at 19:38
    
There is nothing to paste, unfortunately: the command does not grep anything... Kindly refer to my second edit; maybe it has some bearing on all of this. –  sadpluto Aug 16 '12 at 20:42
    
Reinstall cron. –  user535733 Jan 18 at 2:59

1 Answer 1

It's good practice to list the full path for anything being called from a cron job, since the environment variables are not always the same as they are for your user. Additionally, since you are trying to debug things, try writing to the /tmp/ directory instead. Try the following line:

* * * * * /bin/date >> /tmp/datelog
share|improve this answer
    
Thanks for the suggestion (can't upvote yet...). However, this doesn't do it for me. It's really puzzling, since I recall something like this working under Debian. Please refer to my edit. –  sadpluto Aug 16 '12 at 18:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.