ENV vs BASH_ENV
Hi all,
I cannot find out the difference between defining the two variables, but I discovered after a lot that having both set up in my crontab avoids a script to run correctly. For instance if I have in my crontab:
ENV=/home/luca/.profile
BASH_ENV=/home/luca/.profile
then a shell script seems not to execute unless its output is redirect to a file. So the line
00 10 * * * myBackup.sh
does not seem to run (or starts and ends immediatly), while
00 10 * * * myBackup.sh > /tmp/backup.log
works fine. If I run the backup script manually it works (it uses rsync). What's the magic around the above variables?
Thanks,
Luca
I think that the path of the script may be an issue. When you setup scripts in crontab its best to use absolute paths for all commands or scripts.
-Anup
Quoted 27 lines · Luca Ferrari
Hi all,
I cannot find out the difference between defining the two variables, but I discovered after a lot that having both set up in my crontab avoids a script to run correctly. For instance if I have in my crontab:ENV=/home/luca/.profile
BASH_ENV=/home/luca/.profilethen a shell script seems not to execute unless its output is redirect to a file. So the line
00 10 * * *
myBackup.shdoes not seem to run (or starts and ends immediatly), while
00 10 * * *
myBackup.sh>/tmp/backup.logworks fine. If I run the backup script manually it works (it uses rsync). What's the magic around the above variables?
Thanks,
Luca
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · walking on the keyboard,
I think that the path of the script may be an issue. When you setup scripts in crontab its best to use absolute paths for all commands or scripts.
Uhm...I don't believe this is the case, since the script is executed always with a relative path, since I've set the PATH variable in the top of the cron script.
Luca