hi guys,
I made a script that asks the user if he wants to shut down the computer in 10 minutes or wait another hour and I scheduled in cron to run each hour from 18h to 7 am. However it happened two problems:
1 - The box that asks the question does not appear
2 - It does not turn off in 10 minutes but at the time that runs the script as if I had used the now option
ideas?
The Script:
Code:
#!/bin/bash
date=`date`
usuario=`who | sed q | awk -F" " '{print $1}'`
export XAUTHORITY=/home/$usuario/.Xauthority
if zenity --question --text="Seu micro ser desligado em 10 minutos. Tudo bem?" --title="Desligar?" --ok-label="Prorrogar" --cancel-label="Pode Desligar" --timeout=300; then
echo "NAO DESLIGOU "$date >> /tmp/testes_desligar;
else
echo "DESLIGOU "$date >> /tmp/testes_desligar;
/sbin/shutdown -h +10; #already tried shutdown -h 10 but same thing happens...
fi
The CRON job (on /etc/crontab):
Code:
48 0-7,16-23 * * * root /home/myuser/shell/desliga.sh