![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| any possible solution on sql calling scripts | manas_ranjan | Shell Programming and Scripting | 4 | 11-22-2007 02:02 AM |
| Calling SQL LDR and SQL plus scripts in a shell script | rajagavini | Shell Programming and Scripting | 5 | 11-05-2007 02:12 PM |
| script calling other scripts hangs | rein | Shell Programming and Scripting | 1 | 09-07-2007 02:26 AM |
| Calling functions in scripts directly | LiquidChild | Shell Programming and Scripting | 12 | 04-27-2007 03:28 AM |
| Calling SQL scripts through Shell Script | madhunk | Shell Programming and Scripting | 18 | 06-14-2006 09:35 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Issue calling scripts through CRON.
I have the following cron job in the crontab.
#! /bin/bash 25 15 * * 1-5 /export/home/svittala/scripts/scpt1.sh >/dev/null 2>&1. The problem that I am facing is - the scpt1.sh can be executed manually. But, it is not executing through CRON. Not sure what's the issue. Any hints?. Thanks. Satish |
| Forum Sponsor | ||
|
|
|
|||
|
I'd start with eliminating "/dev/null" from your vocabulary. Change that to "/tmp/scpt1.sh.out" instead and you will likely get your answer.
I think the answers to about 90% of our problems are in /dev/null...too bad it's a black hole! |
|
|||
|
Issue calling scripts through CRON.
Per Joe's suggestion, I removed the # bash entry on the first line and also removed the /dev/null and instead redirected the output to a tmp file.
Now, it creates a tmp file with 0 bytes and ofcourse the script did not trigger. This is my simple script: =============================== #! /bin/bash . $HOME/.profile # Informatica Settings #. /ga/applsw/informatica/server/set_informatica_env.sh # File Areas # INCOMING_DIR=/home/applusr/e290147/incoming/ # LOG_DIR=/home/applusr/e290147/log/ # INF_SESS_DIR=/ga/applsw/informatica/server/SessLogs/ PMCMD_DIR=/applsw/informatica/server/powercenter8.1.1/server/bin/ INF_USER=E290133 INF_PASS=etlguy INF_FOLDER=dev_HHSC_EADW INT_SERVICE=hhsc_uce_dev_int_svc DOMAIN=hhsc_informatica_uce_dev # Log Files LOG_DATE=`date +"%m%d.%H%M"` LOG_FILE=${LOG_DIR}scpt1.log.${LOG_DATE} # Return Codes for pmcmd RETCODE_PROD=0 echo "################################################################################" echo "" echo "EXECUTING INFORMATICA WORKFLOW........" echo "" echo "################################################################################" ${PMCMD_DIR}pmcmd startworkflow -sv ${INT_SERVICE} -d ${DOMAIN} -u ${INF_USER} -p ${INF_PASS} -f ${INF_FOLDER} -wait wf_s_test2 RETCODE_PROD=$? if [ ${RETCODE_PROD} = 0 ]; then echo "################################################################################" echo "" echo "SUCCESSFULLY EXECUTED INFORMATICA WORKFLOW........" echo "" echo "################################################################################" echo "scpt1.ksh completed processing successfully at "`date +"%m%d.%H%M"`"\n" >> ${LOG_FILE} exit 0 else echo "scpt1.ksh FAILED at "`date +"%m%d.%H%M"`"\r" >> ${LOG_FILE} exit 0 fi |
|
|||
|
Update on this issue
I just modified my cron to something like this:
45 16 * * 1-5 ls -ltr > /export/home/svittala/scripts/scpt1.sh.out and it looks like it executed perfectly. Not sure whats the issue when I try to call a script. If I put something like this in the command prompt: /export/home/svittala/scripts/scpt1.sh > /export/home/svittala/scripts/scpt1.sh.out it executes fine. Thanks. |
|
||||
|
I don't think joeyg was saying to remove the #!/bin/bash from the start of your script. I think he was pointing out that cron executes everything from bourne shell with a very limited environment. For instance, I doubt that $HOME will be available to the script.
Just change the redirect but leave the #! path at the start. Alternatively, specify the shell you want to run in the cron commandline. Add a -x flag to the shell to get more information if you need it. |
||||
| Google UNIX.COM |