LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-01-2013, 05:08 PM   #1
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Rep: Reputation: 30
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?

Last edited by steve51184; 09-01-2013 at 05:12 PM.
 
Old 09-01-2013, 05:55 PM   #2
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 236

Rep: Reputation: 64
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> .

Last edited by rosehosting.com; 09-01-2013 at 05:57 PM.
 
Old 09-01-2013, 06:12 PM   #3
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Original Poster
Rep: Reputation: 30
'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...
 
Old 09-02-2013, 07:03 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,482

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
You'll also find that */1 is technically not required, * indicates every minute.
 
Old 09-03-2013, 04:00 AM   #5
gdr
Member
 
Registered: Jun 2013
Distribution: Mint KDE
Posts: 44

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


Reply



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] Script not working in cron but working fine manually jasperux Linux - Newbie 2 07-04-2012 11:28 PM
/USR/SBIN/CRON --> Suspicious Capital Letter, cron is not working??? arfal Linux - Server 10 06-22-2012 06:40 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
cron.daily, cron.weekly not working mwhite74 Linux - Server 2 06-07-2007 09:51 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:33 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration