Re: Shutdown computer after a specific command has been executed
Muntasim-Ul-Haque writes:
> Hi,
> I need a tool that would make sure that, my computer would shutdown
> after a specific command has been executed. This tool would just wait
> for the Terminal for executing a command, like '/sudo apt-get upgrade/'
> and then after the command has been executed, my computer would
> shutdown.
If you execute <command> as root (better than using sudo) you can either
issue from the # prompt
command; shutdown -h now
that shuts down the machine either if <command> is successful or fails
while
command && shutdown -h now
shuts down the machine only if <command> is successful. On the other hand
command || shutdown -h now
shuts down the machine only if <command> fails
If you don't run <command> as root you must either wait for <command> to
end (to type the password) or be sure that it completes before the
validity of the sudo password cache expires.
--
/\ ___ Ubuntu: ancient
/___/\_|_|\_|__|___Gian Uberto Lauri_____ African word
//--\| | \| | Integralista GNUslamico meaning "I can
\/ coltivatore diretto di software not install
già sistemista a tempo (altrui) perso... Debian"
Warning: gnome-config-daemon considered more dangerous than GOTO
Reply to: