LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to schedule a script in linux (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-schedule-a-script-in-linux-793541/)

farnaw4u 03-05-2010 11:51 PM

how to schedule a script in linux
 
Hi

i have oracle installed on Linux i want to schedule a script "backup.sh" to run in oracle user.



oracle@linux1]crontab -e
*/2 * * * * /tmp/backup.sh

this script does not execute by cron.

BUT

oracle@linux1 tmp] ./backup.sh ------executes successfully


I dont know why the script is not being executed by cron


kindly help me

nodopro 03-06-2010 12:37 AM

Make sure crond service is running.
Code:

# service crond status
crond (pid  2775) is running...


linuxlover.chaitanya 03-06-2010 12:42 AM

If even cron is running, try this

bash /tmp/backup.sh in the cron file.

giammy 03-07-2010 01:27 PM

Quote:

Originally Posted by farnaw4u (Post 3887879)
Hi
...

I dont know why the script is not being executed by cron

kindly help me

Hi,

please, remember that cron commands are executed with a different
environment: for example you do not have the PATH, so commands that
are found from command line are not found from cron.

Just a supposition!

bye
giammy

repo 03-07-2010 01:55 PM

To test, create a simple script which will create a file .
make sure to give the whole path to the commands and files.
See if it works.
Then you know the problem is the script, not cron

chrism01 03-07-2010 06:31 PM

show the script content; also if it has an error either the cron job owner or root should get an email from cron re any errors. Try

mailx

from the cmd line as owner and as root to see.
Also, check /var/log/messages.


All times are GMT -5. The time now is 06:56 AM.