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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-11-2008, 09:13 AM
|
#1
|
|
Member
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296
Rep:
|
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.
|
|
|
|
02-11-2008, 10:02 AM
|
#2
|
|
Member
Registered: Aug 2006
Distribution: Ubuntu, CentOS
Posts: 31
Rep:
|
Hi uncle-c
Try this in your cronzod file :
Code:
30 * * * * /home/zod/temp/./my-cron
|
|
|
|
02-11-2008, 10:10 AM
|
#3
|
|
Member
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269
Rep:
|
are you running it under the right user
check who owns the file and under which user is the crontab installed
|
|
|
|
02-11-2008, 11:47 AM
|
#4
|
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Debian, FreeBSD, Ubuntu (desktop)
Posts: 3,859
Rep: 
|
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?
|
|
|
|
02-12-2008, 06:05 AM
|
#5
|
|
Member
Registered: Oct 2006
Location: The Ether
Distribution: Fedora 14, Ubuntu , Slax 5.1.8, OpenSolaris, Centos 4.8
Posts: 296
Original Poster
Rep:
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:06 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|