LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 02-11-2008, 09:13 AM   #1
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296

Rep: Reputation: 30
Cannot get crontab to run


Hello there,
Having some crontab woes I'm afraid. I would like to run the "my-cron" script at 30 mins past the hour but its having nothing of it. Below is some output if it helps.

Code:
[zod@PCLOS2007 temp]$ ls
cronzod  mplay.zip  my-cron*  Vintage_Flower.png  wft

[zod@PCLOS2007 temp]$ cat my-cron
#!/bin/bash

cp /home/zod/temp/wft /home/zod/temp/test

[zod@PCLOS2007 temp]$ cat cronzod
30 * * * * /home/zod/temp/my-cron

[zod@PCLOS2007 temp]$ sudo crontab -l -u zod
30 * * * * /home/zod/temp/my-cron
As you can see my-cron file is executable. I've tested it independently and it works fine, and the "cronzod" file seems ok, or does it !!!??

Thanks,
uncle

Last edited by uncle-c; 02-11-2008 at 09:15 AM.
 
Old 02-11-2008, 10:02 AM   #2
akuma_linux
Member
 
Registered: Aug 2006
Distribution: Ubuntu, CentOS
Posts: 31

Rep: Reputation: 15
Hi uncle-c

Try this in your cronzod file :

Code:
30 * * * * /home/zod/temp/./my-cron
 
Old 02-11-2008, 10:10 AM   #3
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Rep: Reputation: 30
are you running it under the right user
check who owns the file and under which user is the crontab installed
 
Old 02-11-2008, 11:47 AM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by uncle-c
I would like to run the "my-cron" script at 30 mins past the hour but its having nothing of it. Below is some output if it helps.

Code:
...
[zod@PCLOS2007 temp]$ sudo crontab -l -u zod
30 * * * * /home/zod/temp/my-cron
[ Side note: stop using sudo to run crontab commands for zod. Do it directly as zod. ]

To isolate this down to a cron issue or an issue with your script, use crontab -e as the zod user, and make an entry:
Code:
* * * * * echo 'Hello from cron'
After a couple minutes, check mail for zod -- you should see mail messages with 'Hello from cron' in the body.

If that doesn't work, do you have /etc/cron.allow or /etc/cron.deny files? If so, what's in 'em?
 
Old 02-12-2008, 06:05 AM   #5
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296

Original Poster
Rep: Reputation: 30
Thanks for the replies everyone. The problem lay in the fact that I had no cron.allow file, hence, I had to use sudo to run the crontab command. This resulted in the /var/spool/cron/zod file having group and owner root. Once I created cron.allow and put user zod in it all was well and there was no need for me to run the sudo command when using crontab. All scripts execute perfectly.
Thanks for all the help !

Cheers,
uncle-c
 
  


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
What does the run-parts mean in crontab? mTorbin Linux - Newbie 15 04-27-2012 03:53 PM
Run crontab job sunhui Linux - Software 2 05-16-2007 08:35 PM
crontab and run-parts gavinbeatty Slackware 4 09-13-2005 06:56 PM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM
Can't run F-Prot with Crontab maxflex Slackware 7 07-31-2004 10:11 AM


All times are GMT -5. The time now is 03:00 PM.

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