Make evomaintenance works if called from a script.

This commit is contained in:
Romain Dessort 2016-04-20 16:32:12 -04:00
parent 7be4dfb65d
commit e3fb815563

View file

@ -15,11 +15,11 @@ test -f /etc/evomaintenance.cf && . /etc/evomaintenance.cf
PATH=$PATH:/usr/sbin
SENDMAIL=$(which sendmail)
# get ipaddress
IP=`LC_ALL=C who -m | grep $SUDO_USER | head -1 | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//"`
IP=`LC_ALL=C who | grep $(ps -o tty= | tail -1) | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//"`
# get begin_date
BEGIN_YEAR=`date "+%Y"`
BEGIN_DATE=`LC_ALL=C who -m | grep $SUDO_USER | head -1 | tr -s ' ' | cut -d" " -f3,4,5`
BEGIN_DATE=`LC_ALL=C who | grep $(ps -o tty= | tail -1) | tr -s ' ' | cut -d" " -f3,4,5`
# end_date
#now()