Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Ubuntu and Kubuntu. I have a cron-job that is run daily on each laptop in the household. The cron job can sometimes take a while to complete (30 mins or so). The cron job is run as root.

How do I prevent users from shutting down the system, while the cron job is running? Actually I would like to prevent them from: Logging out, Shut down or Reboot.

EDIT: I care about users logging out because Network Manager takes down wifi upon logout. This interrupts the cron job.

share|improve this question

migrated from Dec 29 '10 at 12:13

This question came from our site for professional and enthusiast programmers.

Why do you care whether they log out? Cron jobs don't care whether someone is logged in. – CarlF Dec 29 '10 at 13:55
@CarlF The job cannot trivially resume. This is why it must be completed before shutdown. Turbo J: Battery power is no worry. I will detect if the machine is running on battery power otherwise and not run the job if that is the case. – Thomas Feb 16 '11 at 17:29
A 30 min cron job on a (potentially) battery-powered device? Doesn't sound like a good idea to me... – Turbo J Feb 16 '11 at 17:30

Not exactly what you asked for, but you could install the anacron package. Cron jobs will run when the PC is turned back on. If you are worried about jobs being interrupted partway through, that's a different thing--what app is it? Can it detect that it wasn't complete and restart itself?

share|improve this answer

Way to disable shutdown/restart:

I couldn't find way to prevent logout. However, it's possible to remove logout button, and then logging out requires one additional step. Another way is to skip whole problem by configuring wlan not to disconnect on logout.

share|improve this answer

Your Answer


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