#!/bin/bash

# when testing on dev servers do NOT want these cmds to happen!!!
hn=`hostname`
if [ "$hn" != "epgplayer" ]; then
    echo "Dev system sudocmd.sh, host=$hn, cmd=$1, arg=$2" >> /var/www/html/log.txt
    exit
fi

if [ "$1" == "update" ]; then
    # let server respond
    sleep 2
    cd /var/www/html/updateDir && ./update.sh
elif [ "$1" == "init" ]; then
    echo "Killing chrome" >> /var/www/html/log.txt
    timedatectl set-timezone $2
    pkill chrome
elif [ "$1" == "reboot" ]; then
    sleep 2
    reboot
elif [ "$1" == "shutdown" ]; then
    sleep 2
    shutdown now
fi


