LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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-29-2013, 07:35 AM   #1
seyiisq
LQ Newbie
 
Registered: Sep 2013
Posts: 13

Rep: Reputation: Disabled
Cron not working


Hello All,
I have been trying to schedule a task using cron only to realise that it is not working.
Code:
$ ps -ef | grep cron
root      2964     1  0 Nov12 ?        00:00:00 crond
root      2178  2964  0 14:20 ?        00:00:00 crond
seyiisq   2228 20774  0 14:20 pts/0    00:00:00 grep cron
$ crontab -l
* * * * * /usr/bin/date >> /xyz/cron_work.log
$
I have checked the file cron_work.log but it was empty.

Please any advise

However, when i queried the log in /var/log i got

Code:
# tail -10 /var/log/cron
Dec 29 14:29:01 computername crond[3215]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:30:01 computername crond[3258]: (root) CMD (/usr/lib/sa/sa1 1 1)
Dec 29 14:30:01 computername crond[3260]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:31:01 computername crond[3311]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:32:01 computername crond[3371]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:33:01 computername crond[3431]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:34:01 computername crond[3473]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:35:01 computername crond[3513]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:36:01 computername crond[3570]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)
Dec 29 14:37:01 computername crond[3631]: (seyiisq) CMD (/usr/bin/date >> /xyz/cron_work.log)

Last edited by seyiisq; 12-29-2013 at 02:37 PM. Reason: //Retain 0-reply state
 
Old 12-29-2013, 09:33 AM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Check the permissions on directory "/xyz" and on the file /xyz/cron_work.log.
 
Old 12-29-2013, 11:41 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As per Pingu; generally non-root users cannot write to '/' level dirs.
 
Old 12-30-2013, 01:12 AM   #4
seyiisq
LQ Newbie
 
Registered: Sep 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
Hi Chrism01,Pingu

The user seyiisq has write to that directory.He even owns the file

seyiisq:computername:/xyz>ls -lrt cron_work.log
-rw-r--r-- 1 seyiisq dba 0 Dec 29 13:10 cron_work.log

Please, can anyone advise

Last edited by seyiisq; 12-30-2013 at 01:32 AM.
 
Old 12-30-2013, 02:09 AM   #5
seyiisq
LQ Newbie
 
Registered: Sep 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
I did the cron in seyiisq directory and still had the same result

seyiisq:compoutername:/xyz/seyiisq>crontab -l
* * * * * /usr/bin/date >> /xyz/seyiisq/cron_work.log

seyiisq:computername:/xyz/seyiisq>ls -lrt cron_work.log
-rw-rw-rw- 1 seyiisq dba 0 Dec 29 13:10 cron_work.log

After few minutes of monitoring the file cron_work.log remains empty.
 
Old 12-30-2013, 02:45 AM   #6
seyiisq
LQ Newbie
 
Registered: Sep 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
Hello All,

This as been resolved.
Thanks to all who responded
 
Old 12-30-2013, 02:55 AM   #7
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Would you mind telling us how, always good to post solutions.
Also please mark thread "solved".
 
Old 01-01-2014, 08:00 PM   #8
seyiisq
LQ Newbie
 
Registered: Sep 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
I realise that there is no such as /usr/bin/date but /bin/date.

It was a silly mistake on my part

Last edited by seyiisq; 01-01-2014 at 08:42 PM.
 
Old 01-02-2014, 06:45 AM   #9
seyiisq
LQ Newbie
 
Registered: Sep 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
Hello All,

I created my own shell script which ran manually but very difficult using cron.
I have been battling with it all day.

*/10 * * * * /full/path/salary.sh

pls can anyone advise
 
  


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
SVN working copy shared via NFS or local SVN working copies + cron job? deoren Linux - Server 2 10-04-2013 09:11 AM
[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
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 - Newbie

All times are GMT -5. The time now is 08:42 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