LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   can't get cron working on debian (https://www.linuxquestions.org/questions/linux-server-73/cant-get-cron-working-on-debian-4175475491/)

steve51184 09-01-2013 05:08 PM

can't get cron working on debian
 
i'm trying to set up a cron to run a simple command and yet anything i try never actually works

i'm on debian 7 and i've checked that crond is running

the test cron i've been using is this:

file: /etc/crontab
Code:

*/1 * * * * echo "testing cron" >> /home/test.txt
the above should of course made a text file containing 'testing cron' saved to '/home/test.txt' and to do that every 1min but it's failing to do so

any tip on getting cron working?

rosehosting.com 09-01-2013 05:55 PM

is there anything logged in your log files? if you haven't modified your (r)syslog configuration then check syslog for any messages. also, if you use /etc/crontab the syntax you need to use is:

Code:

*/1 * * * * <USER> echo "testing cron" >> /home/test.txt
you can also use 'crontab -u <USER> -e' to manage cron jobs for particular <USER> .

steve51184 09-01-2013 06:12 PM

'Missing newline before EOF, this crontab file will be ignored'

i swear that wasn't there last time i checked.. i've added the EOF line and its' working now... :(

TenTenths 09-02-2013 07:03 AM

You'll also find that */1 is technically not required, * indicates every minute.

gdr 09-03-2013 04:00 AM

"/home/test.txt" - does this file exist and is it writable by the user with whose privileges the cron job runs?


All times are GMT -5. The time now is 08:15 AM.