How do I schedule my backup jobs in Linux? I scheduled a job using crontab, e.g., 30 13 * * * /backup_script/ Nothing happened, it didn't run. My database platform is Oracle 9i and my operating system is Red Hat.

    Requires Free Membership to View

The trickiest thing with scheduling shell scripts in cron is that the shell script does not run with your current environment settings. If you simply execute the shell script at your command line prompt, your script can use all of your session's current environment variables.

When that same script is executed via cron, you do not get your session's environment variables. So your shell script needs to have the environment variables it needs coded in the script.

To run the shell script just like cron would run it, use the "sh -x" command. For instance, to run your backup script like cron would, do the following:

sh -x /backup_script/
If there is an error in your script, you will find it when it is run in this manner. Fix any and all errors and then cron should have no problems running this script.

This was first published in September 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: