LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   problems setting the user in crontab (https://www.linuxquestions.org/questions/linux-software-2/problems-setting-the-user-in-crontab-343087/)

p.gaic 07-14-2005 05:57 AM

problems setting the user in crontab
 
hi everyone:):):):)
i'm having a problem executing a sheduled job from crontab

i'm trying to start a backup script for my oracle database from crontab .
the command line in the crontab is :
12 12 * * * /home/oracle/backup.sh

backup.sh is as folows:
exp useid=..... file=...... log =...

as you can see , the command to be executed is "exp" and this command cannot be executed as user root but only as user oracle

i've tried editing the crontab file for the user oracle :
crontab -u oracle -e

but i still get the same error :
exp : command not found
when i start the script manualy , everuthing works just fine

i'm assuming the reason is that crontab is trying to execute the script as root and it cannot recognize the command.
how can i edit the crontab file so that it starts the script as user oracle?????
i've tried to set the crontab like this:
12 12 * * * oracle /home/oracle/backup.sh
but then i get the error :
oracle:command not found

please help , i've tried everything

Matir 07-14-2005 11:07 PM

cronjobs have a VERY limited path, in some cases just /bin. Your two options are to set a different path in your crontab (PATH=/some/path:/some/other/path:/usr/bin:/bin) or, preferrably, to use an absolute path in your script.

Using a dedicated crontab for oracle is preferred, as I understand, as opposed to cluttering the system-wide crontab.


All times are GMT -5. The time now is 10:09 PM.