Yes, I should definitely be more specific about this. There's a lot I left out.
Here's the scripts in question:
after_hours_root.sh
Code:
#!/bin/bash
for (( ; ; ))
do
z_hr=`date +%H`
echo $z_hr
if [ $z_hr -gt 21 ] || [ $z_hr -lt 5 ]; then
sleep 960
/sbin/shutdown -h now
else
sleep 600
fi
done
after_hours_user.sh
Code:
#!/bin/bash
export DISPLAY=:0.0;
export XAUTHORITY=$(ps h $(pidof X) | awk '{print $11}');
for (( ; ; ))
do
z_hr=`date +%H`
if [ $z_hr -gt 21 ] || [ $z_hr -lt 5 ]; then
/usr/bin/xmessage -button ok -center "Its too late to be on the computer. You have 15 minutes." &
sleep 900
/usr/bin/xmessage -button ok -center "1 minute to Shutdown" &
sleep 600
else
sleep 600
fi
done
hourly_reminder.sh
Code:
#!/bin/bash
export DISPLAY=:0.0;
export XAUTHORITY=$(ps h $(pidof X) | awk '{print $11}');
for (( ; ; ))
do
sleep 3600
#sleep 3
/usr/bin/xmessage -button ok -center "Hourly reminder to get off the computer"
done
(I made two files named hourly reminder: starter script & the above one.)
And here's the script that starts it:
hourly_reminder.sh
Code:
sleep 60
/bin/su - joe -c "/bin/bash /home/joe/Scripts/hourly_reminder.sh" &
/bin/su - joe -c "/bin/bash /home/joe/Scripts/after_hours_user.sh" &
/bin/bash /home/joe/Scripts/after_hours_root.sh &
The line at the end...
Code:
/bin/bash /home/joe/Scripts/after_hours_root.sh &
...is where I have been adding and subtracting the "&".
The starter script is in /etc/init.d/
This is what I did when I added the starter script:
http://embraceubuntu.com/2005/09/07/...run-at-bootup/
(I'm not sure if the script is run because it's in the init.d folder, or because I used the "update-rc.d <script> defaults" command as per the guide above.)