1

I've been scouring the internet for a solution, but I have a shell script I want to run that works fine from the cli but not from cron.

This works from my prompt: sh ~/Applications/scripts/script.sh

crontab entry:

* * * * * /home/user/Applications/scripts/script.sh

script looks as follows:

#!/bin/sh
/usr/local/bin/myapp update &> /home/user/myapp_sh_update_stdout.log
/usr/local/bin/myapp run &> /home/user/myapp_sh_run_stdout.log

Thoughts? Experiments with other answers are no good for me, so I am going specific to see what I could do differently. Running it every minute to debug, but it will be run at a morning hour on one day of the week when confirmed working.

chow
  • 225
  • 2
  • 8

1 Answers1

2

&> is a bashism - either change the shebang to #!/bin/bash or change the redirections to

/usr/local/bin/myapp update > /home/user/myapp_sh_update_stdout.log  2>&1
/usr/local/bin/myapp run > /home/user/myapp_sh_run_stdout.log 2>&1
steeldriver
  • 136,215
  • 21
  • 243
  • 336