1

I have a script called install.sh. This script execute some others script. All work fine just he call a *.sql script. In this case call the script but exit without give an error but don't execute the sql script. Manually, if I call install.sh with an user, all script work correctly.

I create the cronjob with the same user as used to test manually.

Script:

#! /bin/bash
echo "start"
cd /path/to/script/install.sh
./install.sh
echo "End"

Cronjob:

01 01 * * * /full/path/to/start_script.sh
2
  • Check if all the environment variables are set correctly in your cron job. Usually cron jobs do not call the user's profile. Commented Feb 3, 2016 at 13:59
  • I know, I try to add the path into the script but nothing change. How I set the variables in my cronjob?? Commented Feb 3, 2016 at 14:02

1 Answer 1

1

More trace are needed.

Could you modify your script to generate output in a log file?

#! /bin/bash
exec 1>>/tmp/debug.log
exec 2>>/tmp/debug.log
date "+%Y/%m/%d %H:%M:%S ====== S T A R T"
cd /path/to/script/install.sh
bash -x ./install.sh
date "+%Y/%m/%d %H:%M:%S ====== E N D"

Wait the next execution and use debug.log file to debug

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.