Shutdown PC after command is done?
by ddenial from LinuxQuestions.org on (#5411D)
Hello All
Is there a way to shutdown PC after the existing command is done executing?
I have this shell script which takes one or more hours to finish. Sometimes in the middle of the runtime, I have to leave PC and go out for other work. I have a dilemma - should I cancel the running process by Ctrl+C and shutdown PC or just leave it running. Most of the time I return after several hours, in this time the PC would be sitting there idle consuming power after it has finished the command.
So my question - Is there a way to append like '&& systemctl shutdown' to existing command/process which is already executing?
Thanks


Is there a way to shutdown PC after the existing command is done executing?
I have this shell script which takes one or more hours to finish. Sometimes in the middle of the runtime, I have to leave PC and go out for other work. I have a dilemma - should I cancel the running process by Ctrl+C and shutdown PC or just leave it running. Most of the time I return after several hours, in this time the PC would be sitting there idle consuming power after it has finished the command.
So my question - Is there a way to append like '&& systemctl shutdown' to existing command/process which is already executing?
Thanks