Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the simplest way to disable or temporarily suspend reboot/shutdown when an important process is running? The process takes too long to finish and cannot be paused/resumed so I like to avoid shutting down the pc while it is running. It is run from cron so unless I manually check for running processes, I wouldn't know that it is running. Thanks.

share|improve this question
4  
Possible duplicate: SO: Temporarily prevent linux from shutting down, the answers hint on the various levels on which this can be done, i.e. shell scripts or the desktop environment's power management. –  sr_ Mar 19 '12 at 9:07
    
I don't think that answer is specific enough without an either explanation of runlevels or link to explanation. It's not in the U&L SE. May I ask which distro and version you're using? –  bdowning Mar 19 '12 at 22:13
    
Rather than modifying the shutdown procedure, write a wrapper so the job indicates its finished, either mail or touch a file. Test for job completion, then run shutdown. (cron mails the output of its jobs to owner, but that can be tweaked). –  bdowning Mar 22 '12 at 10:53
add comment

1 Answer 1

up vote 0 down vote accepted

Run which shutdown to see where the path to the shutdown program is. You can rename the file, although I recommend against it.

Another (safer) method. Use an alias: alias shutdown=' ' Something like this is more reversible. If you're trying to prevent shutdown from all users, add the alias globally.

share|improve this answer
    
I'm thinking of using an alias, now I just have to write my script. Thanks! –  zang3tsu Mar 23 '12 at 7:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.