-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels