I am working on exadata environment. Application team require some reports on every Sunday. So we put the below mentioned script on cron. when we are running those command manually it is working fine but when it is running through cron all the logfile size become 0. could you give me some idea why it is showing 0 bytes..Pplease let me is there anyway where i can post attachment here.i am new to this forum.
Keep in mind that cron spawns a child process WITHOUT running the +.bash_profile+ for that o/s user, when running a script for that o/s user.
This means that if that script's contents rely on environmental variables like ORACLE_HOME and so on - these will not be set. And this will cause such commands in the script to fail. The same script will however execute fine from the command line as that interactive shell session will have a valid environment.
Two basic choices.
Set the environment name-values in that crontab file. See cron documentation for details.
Check for a valid environment in that script - if not detected, source the +.bash_profile+ environment settings manually. Only then proceed in the script with the running of the commands and code in the script.
In addition to the previous reply, cron by default also sends a report by mail. You might want to check the output.
Perhaps you can solve your problem by including the full path to the "dcli" utility in your shell script, including any env variables necessary.
Regarding attachments, as the Oracle forum "super admin" points out, there is and won't be attachments for non Oracle employees. Perhaps you find the following info useful: How can I attach a file to a post
Cron will only search for programs in /usr/bin and /bin. So in order for cron to find a program that is not in /usr/bin or /bin, you either need to specify a $PATH environment variable in your shell script, or simply use the absolute path to the program.
I don't know where you have the dlci program stored, but you can try to login as root and type:
ls -l /usr/local/bin/dcli
and see what happens. Then specify the full path in your script, e.g. /usr/local/bin/dcli
I recommend to add "2>&1" to your command to include possible errors in your logfile, for instance:
/wrong/path/ls -l > out.log 2>&1
-bash: /wrong/path/ls: No such file or directory