I have a small internet cafe with 7-9 Ubuntu 12.04 workstations. Unfortunately, I can't be there every week.
I've seen a Java solution to upgrade the system, after a normal (non-sudo/admin) user requests a shut down (but not restart!) the system upgrades itself - the base system is Ubuntu 10.04 as I remember, but the programs, and the desktop manager is fully customized, with custom softwares (eg. to check the printers' ink level...)
That's why I thought, that if I could set up something similar in our environment, it would be very useful. I've already scripted in Bash, and used Zenity, so I only want to know:
- how can I call/run my script?
- how can I run root commands(sudo required) inside that script? (eg. sudo poweroff or halt)
Here is an overview of what you can do.
If you want to check for an upgrade every time the machine is going down you can turn your script into a system v init-script that will run on level 0 (shutdown).
To do this:
This will send a stop command (K 01myscript) to your script at the beginning of shutdown process (K 01 myscript - meaning, before others). I'm not sure, but maybe you'll have to cancel shutdown at the beginning of the script -
shutdown -c now
and issue it again at the end -shutdown -h now
.The script will be executed already as root so you don't need any sudo commands. You just need to have permissions create the mentioned files.