4

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.
jokerdino
  • 41,320
Tim
  • 51
  • 1
  • 3
  • Have you checked root's cron entries (sudo crontab -l) or the contents of /etc/cron.daily if you have anacron installed? – StarNamer Jul 26 '12 at 11:24
  • 1
    Welcome Tim: Assuming your using 12.04 you can browse through all the apps you have installed in the "Dash" by selecting the Application Lens (at the bottom of the screen), then select Installed Apps – stephenmyall Jul 26 '12 at 11:26
  • That won't help him much I guess. @Tim a good starting point is to check your systems log (/var/log/syslog), which should mention the shutdown event (and hopefully who initiated it). Also the places named by StarNamer above, plus /etc/cron.d. – Izzy Jul 26 '12 at 12:08
  • @StarNamer Here's what happened when I tried 'sudo crontab -l'

    4 6 * * * /sbin/poweroff # JOB_ID_1

    – Tim Jul 26 '12 at 12:23
  • @Izzy

    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.

    – Tim Jul 26 '12 at 12:28
  • Tim, keep editing your original post (the question) with the additional information you provide. That way, it will be all in one place. –  Jul 26 '12 at 12:29
  • @Tim that's it. Just delete that line -- see my answer below. – Izzy Jul 26 '12 at 12:30
  • @Izzy, I'm sorry which line should I delete? – Tim Jul 26 '12 at 12:32
  • @Tim see my answer below -- of course (and only) the line containing the "poweroff". – Izzy Jul 26 '12 at 12:39

1 Answers1

6

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.

Izzy
  • 3,570
  • Done. Thanks a lot! I'll confirm it tomorrow. What do you think caused this auto-shutdown thing to happen? I want to have an idea so I don't repeat the same mistake again. – Tim Jul 26 '12 at 12:40
  • Some application entered that line to the crontab (I just edited my answer again to explain in detail how to read that line). It must have asked you for a password before, as this crontab can only be edited with root/sudo. To becalm you: I never encountered anything doing so without being asked -- so probably it was one of those "tools" you mentioned you might have tried before. – Izzy Jul 26 '12 at 12:47
  • Problem solved! As confirmed this morning when my PC didn't shut down at 6:04 am. Thanks again. – Tim Jul 27 '12 at 14:08