Problems with user environments when run cron
I have a user Oracle in the Server Suse 10, the user environments put in .profile.
The User Oracle have few cron but and this cron execute scripts RMAN backup.
The output about cron is
Subject: Cron <oracle@db10gserver> sh /u01/backup/scripts/testeo.sh 2>&1 >> /u01/backup/scripts/logs/testeo_rman.log
Date: Tue, 21 Oct 2008 15:17:01 -0300 (CLST)
': not a valid identifiero.sh: line 1: export: `
Message file RMAN<lang>.msb not found
Verify that ORACLE_HOME is set properly
The environment is in the script but The Cron take another environment.
i thinks the problem is the environment about user Oracle,
When one cron is executed, what bash is executed similar a .profile when one user logon on server ?
The cron line
10 0 * * 1,3,5 /backup/scripts/incremental_backup_rman.sh 2>&1 >> /backup/scripts/logs/incremental_backup_rman.log
The Script RMAN
rman target=/ << EOF
backup incremental level 1 cumulative tag '%TAG_Level1' database;
backup tag '%TAG_ARCHIVELOG' archivelog all not backed up delete all input;
S.O Suse 10.
cron does not execute the user's profiles and has an environment different to a login shell. First you should not start a shell script using "sh /path/to/script", you should explicitely specify the shell to use: "/bin/bash /path/to/script" and you should define the complete environment you need within the script (you can source the user's profiles: ". /home/oracle/.bashrc" for example).
I agree he needs to add or source the correct env inside the shell script.
Another point: Even if you define the shell at the shebang line - if you call the script using sh /path/to/script, the calling shell executes the script and doesn't take care of the shebang line:
|All times are GMT -5. The time now is 11:11 AM.|