Ubuntu – Why does the computer shuts down itself every morning at 6 AM


My computer shuts down by itself at a specific time everyday 6:00am. I can't find what's causing it.

I'm a long time Windows user and just recently tried Ubuntu. So I don't know anything about Linux commands. I remember when I was starting out with Ubuntu, I tried to look for an auto-shutdown program. I'm using qshutdown right now. It's working OK and I'm pretty sure my auto shutdown problem is not cause by qshutdown since I checked all of its settings.

Now, maybe when I was still new to Ubuntu, I maybe installed some package about auto shutdown. I really can't remember if I did or didn't. But if I did, I don't know where to begin looking for it.

If I didn't install by accident, any other autoshutdown progam, what do you guys think may be causing the timed shutdown of my PC?

$ sudo crontab -l
4 6 * * * /sbin/poweroff # JOB_ID_1 

Here's what my syslog says:

Jul 26 06:04:01 ubuntu CRON[2593]: (root) CMD (/sbin/poweroff # JOB_ID_1)  
Jul 26 06:04:01 ubuntu kernel: Kernel logging (proc) stopped.  
Jul 26 06:04:01 ubuntu rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="795" x-info="http://www.rsyslog.com"] exiting on signal 15.

Best Answer

To find what's causing it, there are multiple sources you could look up:

  • check /etc/cron.daily and /etc.cron.d for contained files
  • check root's crontab using sudo crontab -l
  • check the system log (/var/log/syslog) which should mention the execution of this event

As it turned out, in your case the cause was in root's crontab:

sudo crontab -l
4 6 * * * /sbin/poweroff # JOB_ID_1

Which is confirmed by your /var/log/syslog, as you wrote:

Jul 26 06:04:01 ubuntu CRON[2593]: (root) CMD (/sbin/poweroff # JOB_ID_1)

Explanation of above crontab line: 4 minutes past 6 on every day and every month, every weekday execute /sbin/poweroff (i.e. switch off the computer). remark: JOB_ID_1 (i.e., everything following a '#' is treated as comment).

Just do a sudo crontab -e to edit that crontab. Using the cursor keys, move the cursor to that line and remove it. Assuming vi will be used as editor, enter dd (which removes that line), followed by :x to save it back and exit the editor.

Now the event is removed, and no longer will be executed -- problem solved.

Related Question