Say I have a script named "mydailyscript" containing the following:
#!/bin/bash
if [ ! -z $MYDAILYLOG]; then
exec 1>$MYDAILYLOG
fi
echo This script ran on $(date)
and I then copy this script to /etc/cron.daily.
Where do I define the environment variable, MYDAILYLOG?
i.e. MYDAILYLOG=/var/log/mydailylog
Do I append a line to /etc/environment?
sudo echo "MYDAILYLOG=/var/log/mydailylog" >> /etc/environment