LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices



Reply
 
Search this Thread
Old 08-21-2007, 10:18 AM   #1
Blazeix
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Rep: Reputation: 0
Using Cron


Hi, I have an account on a RedHat 4 server. I would like to have a cron job run at a certain time. In order to test it I made a simple script called cronTest.sh:
Code:
$ cat cronTest.sh 
#!/bin/bash
touch /path/to/my/account/testpad/testComplete
touch /path/to/my/account/testpad/testCompleteAgain
touch /path/to/my/account/testpad/testComplete3
I put the following entry in crontab:
Code:
$ crontab -l
50 9 * * * /path/to/my/account/testpad/cronTest.sh
So, cronTest.sh should run at 9:50 every morning, and create three empty files in the 'testpad' directory. Unfortunately, at 9:50 I got the following system mail:

Code:
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/path/to/my/account>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=username>
X-Cron-Env: <USER=username>

/bin/sh: /path/to/my/account/testpad/cronTest.sh: Permission denied
Permissions of the testpad directory:
Code:
drwxrwxrwx  2 username games 2048 Aug 21 09:48 testpad
Permissions of cronTest.sh
Code:
-rwxrwxrwx  1 username games 228 Aug 21 09:34 cronTest.sh
Does anyone know what's going on? Is it something on my part, or should I contact my sysadmin? Thanks for any help!
 
Old 08-21-2007, 11:07 AM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,024
Blog Entries: 5

Rep: Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789
What are the permissions on "/path/to/my/account/testpad" directory?

Were you logged in as the same "username" that owns the file when you executed your "crontab -e" to add the entry?

Check to make sure the file in /var/spool/cron/crontabs that contains the entry is named for the "username" you expect it to run as.
 
Old 08-21-2007, 11:15 AM   #3
Blazeix
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jlightner View Post
What are the permissions on "/path/to/my/account/testpad" directory?
Hi, the permissions to the testpad directory are in my first post (2nd from the bottom). The permissions are 777.

Quote:
Originally Posted by jlightner View Post
Were you logged in as the same "username" that owns the file when you executed your "crontab -e" to add the entry?
I believe so. I only have one account on this system. When I am logged in to my account and execute 'crontab -l', I see the 'cronTest.sh' cronjob from my first post. Also, I set the permissions of cronTest.sh to 777, so anybody should be able to run it.

Quote:
Originally Posted by jlightner View Post
Check to make sure the file in /var/spool/cron/crontabs that contains the entry is named for the "username" you expect it to run as.
Unfortunately, I get a permission denied error when I try to do this.
$ cat /var/spool/cron/crontabs
cat: /var/spool/cron/crontabs: Permission denied

I don't have root access to this machine. Thanks for your help.
 
Old 08-21-2007, 12:29 PM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,024
Blog Entries: 5

Rep: Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789
It could be an issue with /etc/cron.deny or /etc/cron.allow. Those files determine who can and can not use cron.

I'm afraid you'll have to have your systems admin look into this. the rwxrwxrwx means everyone can read, write and execute so the permission issue isn't on your directory or file.
 
  


Reply

Tags
cron, crontab, permissions


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
cron file 000-delay.cron (it is on my FC5) - what is the purpose? jtmoon Linux - Server 1 03-08-2007 12:15 PM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U Suse/Novell 11 01-04-2007 02:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 10:57 AM


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