1837984 Members
2748 Online
110124 Solutions
New Discussion

crontab newbie problem

 
Tonatiuh
Super Advisor

crontab newbie problem

I added the username to the /usr/lib/cron/crontab.allow

Connected as root I created the username file (user13 file) in /var/spool/cron/crontabs and did the "chown user13 user13" and connected as user13 I did the "chmod u=rw user13", with the information of the task to perform:

5,10,15,20,25,30,35,40,45,50,55,00 * * * * /home/user13/test.sh

But the script test.sh does not execute every 5 minuts.

What did I do wrong?


7 REPLIES 7
Sundar_7
Honored Contributor

Re: crontab newbie problem

I dont think cron is going to pick up the files you manually created in /var/spool/cron/crontabs directory, unless otherwise you restart cron.

Proper way would be to log in as user and create the crontab file.

1) remove the user13 file from /var/spool/cron/crontabs directory

2) # su - user13
user13> crontab -e
5,10,15,20,25,30,35,40,45,50,55,00 * * * * /home/user13/test.sh
user13>

Now the script should get executed.

-- Sundar


Learn What to do ,How to do and more importantly When to do ?
RAC_1
Honored Contributor

Re: crontab newbie problem

shouldn't you add user to /var/adm/cron/cron.allow??

As a user12, what does
crontab -l says??

What is there in /var/adm/cron/log??

Is the execute perms set on test.sh??

Anil
There is no substitute to HARDWORK
Sanjay_6
Honored Contributor

Re: crontab newbie problem

As that login id, you have to add the jobs to the cron.

Login as that user.

create a file with the cron job.

do "crontab file_name" as the user for whom this cron job needs to be added.

Creating a file under crontabs by root does not help.

Hope this helps.

Regds
Tonatiuh
Super Advisor

Re: crontab newbie problem

The user13 does not have write privilege to directory /var/spool/cron/crontabs.

As root user, what is the syntax to give write privilege to this directory to user13?
Patrick Wallek
Honored Contributor

Re: crontab newbie problem

The user does not need write privileges to the directory is you 'su - user13' and then use 'crontab -e' to edit the crontab file.

Give it a try. It will work.

# su - user13

$ crontab -e

Add your info as above and save it. If you then want to check it do

$ crontab -l

And the use should be added to /var/adm/cron/cron.allow to allow them access to use cron.
Sundar_7
Honored Contributor

Re: crontab newbie problem

the user need not have write permission to /var/spool/cron/crontabs directory to create cron jobs.

Do not change the permissions ! :-).

/usr/bin/crontab command can be used by any user (that are allowed to have a crontab) to create/delete/modify their crontab files.

/usr/bin/crontab is a SETUID binary.
Learn What to do ,How to do and more importantly When to do ?
Tonatiuh
Super Advisor

Re: crontab newbie problem

It has worked. THANKS!