Closed keithrz closed 9 years ago
In general setting environment variables via crontab is done by calling a shell script to setup your variables and execute the main program. Some implementations of cron support env vars using -e
but it is not universal. Safer to use the wrapper script.
@keithrz Why do you want to set env variables programmatically? What is your use case? At the moment I am inclined to think that this functionality is outside the scope of node-crontab which is cron job manipulation.
@keithrz Give this a try:
00 09 * * * source /path/to/a/file/with/your/env/variables && ls -l >> /opt/log/ls-output.log 2>&1
I have an existing crontab that I want to recreate with this library. The first line has a MAILTO command like this: MAILTO=example@test.com
full crontab -l example: MAILTO=unix_root@example.com,developer@example.com
00 09 * * * ls -l >> /opt/log/ls-output.log 2>&1
More info: http://www.cyberciti.biz/faq/linux-unix-crontab-change-mailto-settings/