Help - Search - Members - Calendar
Full Version: Using Cron As Non-root User...not Working
Linuxhelp > Support > Technical Support
weslowsk
Hi All,

not really a newbie, just really stumped & frustrated...I thought I knew cron but either I don't or it's not working properly...

here's the problem:

- trying to run a crontab as a non-root user

crontab cron_script

where cron_script is my crontab file;
after I do a:

crontab -l

it shows up fine there;

but when the time comes for the script to execute, it doesn't execute, and there is no log of the execution, nor an email sent to user indicating the status of the cron job

Here's what I've checked already:

/var/log/cron shows:

May 1 09:51:12 mysystem crontab[12695]: (myuser) REPLACE (myuser)
May 1 09:51:16 mysystem crontab[12696]: (myuser) LIST (myuser)
May 1 09:52:00 mysystem crond[12495]: (myuser) RELOAD (cron/myuser)

so, that shows that crond is allowing the non-root user to have a crontab

The frustrating part is that the root user CAN run exactly the same cron commands...

so, I thought it might have to do with a cron.deny or cron.allow file(s); well those parts seem to be working according to the documentation...
when neither file existed (which was by default), I was getting the same sort of stuff in my /var/log/cron file as shown above;
when the cron.allow file existed and was empty, myuser wasn't allowed to set a crontab, as shown by this snippet from /var/log/cron:

May 1 09:24:32 mysystem crontab[12457]: (myuser) AUTH (crontab command not allowed)

and finally, when I scrapped my cron.allow and put in a cron.deny (which was empty) and is now the current configuration, I was back to the original /var/log/cron messages I was getting before;

some stuff about my system:
Redhat Linux 7.1

rpm -qa | grep cron shows:

crontabs-1.9-2
anacron-2.3-16
vixie-cron-3.0.1-62

So, have I missed checking something? Is this a bug?

Thoughts? Ideas? Suggestions?

Kevin
Robert83
Hi,

could you please tell us what is the command your are trying to run with cron ?


Sincerely
Robert B
weslowsk
I've tried various commands; initially, I had it running a "backup cleanup" script, and because I thought there was something wrong with script, I changed it to a simple "touch" command, to test out cron:

/home/myuser/backup_cleanup.bash

and, more recently:

/bin/touch /home/myuser/test.txt
hughesjr
so, as the user, run the command:

crontab -e

and add this:

01 05 * * * /bin/touch /home/myuser/test.txt

then at 0501 you should see the cron has run.

You can substitute a different time ... say 2 minutes from your current time ... for testing
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.