You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me a while to figure out that environment variables are not passed to aw-update scripts, because they are run from a cronjob. As a workaround I've put environment variables that I need in a file from an aw-setup script, and this file can be sources from an aw-update script. But it's not that pretty.
#!/bin/sh
#
# /aw-setup.d/update-env.sh
#
# As aw-update scripts run from a cronjob, the environment variables are not available :(
# We store the relevant variables in a config file that can be sourced.
#
cat >/etc/awstats/aw-update-env <<EOF
MY_VAR="${MY_VAR}"
<<EOF
#!/bin/sh
#
# /aw-update.d/foo.sh
#
# Do foo before updating the stats.
#
# This file runs in a cronjob, hence the environment variables are not available :(
# The relevant variables are stored in a config file in an aw-setup script.
. /etc/awstats/aw-update-env
echo "Foo with ${MY_VAR}!"
I'm configuring some things from a docker-compose.yml file, that's why I need to reference environment variables.
The text was updated successfully, but these errors were encountered:
It took me a while to figure out that environment variables are not passed to aw-update scripts, because they are run from a cronjob. As a workaround I've put environment variables that I need in a file from an aw-setup script, and this file can be sources from an aw-update script. But it's not that pretty.
I'm configuring some things from a
docker-compose.yml
file, that's why I need to reference environment variables.The text was updated successfully, but these errors were encountered: