LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   crontab for diffrent user than root doesnt work (https://www.linuxquestions.org/questions/linux-server-73/crontab-for-diffrent-user-than-root-doesnt-work-739138/)

dlugasx 07-10-2009 05:53 AM

crontab for diffrent user than root doesnt work
 
Hi all,

I have a huge problem with crontab in CENTOS. In my opinion everything is fine in configuration but it still doesnt work.

I would like to make an oracle user dump with exp command. As everybody knows script must be executed by oracle user. So, I`m going to crontab


Quote:

oracle@myhost# crontab -e
I`m putting new entry to crontab

Quote:

10 1 * * * /backup/scripts/backup-script-oracle.sh
I`m saving crontab.

and nothing... doesnt work.

I have all environment settings in crontab:

Quote:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=dba@mydmomain.com
HOME=/


Maybe somebody can tell me why its not working ?

I dont want to put file to /etc/cron.daily or should I create new folder for that script for example /etc/cron.oracle ?


...help...

repo 07-10-2009 05:56 AM

Any error messages in the logfiles?
Make sure the script contains the complete path for the commands

dlugasx 07-10-2009 06:06 AM

Quote:

Originally Posted by repo (Post 3603165)
Any error messages in the logfiles?
Make sure the script contains the complete path for the commands

/var/log/cron - no errors, it looks like script was executed by oracle

I have full paths to commands.

dlugasx 07-10-2009 06:38 AM

problem has been solved


in /etc/crontab

I have put the command

Quote:

05 05 * * * root su - oracle -c "/path/to/script/backup-oracle.sh"
its working like a charm...




I think for command

Quote:

oracle@myhost# crontab -e
I have to put all environments settings like I have in the bash_profile for oracle user. But this should be check.


All times are GMT -5. The time now is 03:59 AM.