I have a python script that I would like to add a "Shutdown when done" feature to.
I know I can use gksudo (when the user clicks on "shutdown when done") to ask the user for root privileges but how can I use those privileges at a later time (when the script is actually finished).
I have thought about chmod u+s on the shutdown command so I don't need a password but I really don't want to do that.
Any ideas how I can achieve this?
Thanks in advance, Ashy.
Instead of chmod u+s
ing the shutdown command, allowing passwordless sudo access to that command would be better..
As for allowing shutdown at the end of the script, I suppose you could run the entire script with sudo, then drop privileges to the initial user at the start of the script?
gksudo should have a timeout, I believe it's from the time you last executed a gksudo command.
So I think I'd just throw out a "gksudo echo meh" or something every minute. Should reset the timer and keep you active until you reboot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With