I'm wondering if there is an more elegant solution by defining the scope of my shell variables only once? (export QUERY_STRING;
)
Here are a couple of my crontasks, notice that I'm currently exporting each shell variable for each task:
2 0 1 * * QUERY_STRING='drink/beer/carlsberg'; export QUERY_STRING; /usr/local/bin/php -e /home/myuserdir/public_html/index.php
4 0 1 * * QUERY_STRING='food/pizza/hawai'; export QUERY_STRING; /usr/local/bin/php -e /home/myuserdir/public_html/index.php
Use env(1)
:
env QUERY_STRING=food/pizza/hawai /usr/local/bin/php -e /home/myuserdir/public_html/index.php
Or the short form of export
:
export QUERY_STRING=food/pizza/hawai; /usr/local/bin/php -e /home/myuserdir/public_html/index.php