Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cron script variable expansion not so good?

Tags:

cron

This file below is in /etc/cron.d. Ubuntu 12.04 Server BTW.

zurmo_install_path="/var/www/zurmo"
zurmo_commands_path="$zurmo_install_path/app/protected/commands"

*/1 * * * * www-data cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager  super EmailArchiving >/dev/null 2>&1
*/1 * * * * www-data cd "$zurmo_commands_path" && ./zurmoc jobManager  super ProcessOutboundEmail >/dev/null 2>&1

The first item fires off fine, the second does not. Once I change the second line to use the literal path and not the variable, it fires off fine. Yet when I write my own test cron job to use variables, they work ok. This is a real stumper!

like image 729
CaptSaltyJack Avatar asked Oct 24 '13 20:10

CaptSaltyJack


1 Answers

Yes, this is a limitation of the crontab variables. The string on the right of the = sign is interpreted literally... See the docs (man 5 crontab)

like image 80
shx2 Avatar answered Oct 05 '22 15:10

shx2