157 votes
Accepted

What is the difference between these commands for bringing down a Linux server?

And now, the systemd answer. You're using, per the tag on your question, Red Hat Enterprise Linux. Since version 7, that has used systemd. None of the other answers are correct for the world of ...
  • 63.4k
75 votes

How to find out from the logs what caused system shutdown?

TLDR Use these 2 commands and keep reading for more information. last -x | head | tac grep -iv ': starting\|kernel: .*: Power Button\|watching system buttons\|Stopped Cleaning Up\|Started Crash ...
  • 2,310
74 votes

What is the difference between Halt and Shutdown commands?

The past In the 1980s, the BSDs had halt, reboot, and shutdown. System 5 UNIX had a BSD compatibility toolset. But natively it had its own, different, shutdown command; and didn't have halt or ...
  • 63.4k
71 votes
Accepted

Why does reboot and poweroff require root privileges?

Warning: by the end of this answer you'll probably know more about linux than you wanted to Why reboot and poweroff require root privileges GNU/Linux operating systems are multi-user, as were its UNIX ...
  • 4,162
69 votes

How do I shut down a Linux server after running for 60 minutes?

There are a several options. Provide time directly to shutdown -P: shutdown -P +60 Note that shutdown man page also points out: If the time argument is used, 5 minutes before the system goes ...
  • 13.5k
55 votes

A stop job is running for Session c2 of user

A workaround to this problem is to reduce this timeout in /etc/systemd/system.conf down from 90s to for example 10s: DefaultTimeoutStopSec=10s and run the following command in terminal after making ...
  • 1,192
48 votes
Accepted

What is the difference between shutdown 18:00 and at 18:00 shutdown?

at 18:00 shutdown now creates an "at" job, which is performed at the specified time by the at daemon or perhaps the cron daemon, depending on your system. shutdown 18:00 starts a process in your ...
  • 15.2k
47 votes

Why does reboot and poweroff require root privileges?

Linux has its origins in Unix and Unix was initially developed as a multi-user operating system. You could have one user disrupt other users by wanting to reboot the system. Only the administrator ...
  • 505
41 votes
Accepted

What exactly is "a stop job", as in "A stop job is running..."?

systemd operates internally in terms of a queue of "jobs". Each job (simplifying a little bit) is an action to take: stop, check, start, or restart a particular unit. When (for example) you ...
  • 63.4k
39 votes

A stop job is running for Session c2 of user

This problem can have many causes, so specific answers don't work too well. Try this for troubleshooting: wait for the "A stop job is running for Session c2 ..." message to appear on shutdown and ...
  • 522
37 votes

How can I shutdown a RHEL server at 06:45 tomorrow morning?

You should use the at command: $ sudo at 6:45 [sudo] password for root: warning: commands will be executed using /bin/sh at> poweroff at> <EOT> Don't type the <EOT>, but press ...
  • 76k
36 votes

Why does reboot and poweroff require root privileges?

Its quite natural and a policy matter and convenience, it had been allowed from GUI because you are physically logged in to the machine. ( Some Linux distributions will still ask you for password if ...
  • 6,886
35 votes
Accepted

How can I prevent the second command in a chain while keeping the first one running?

As you clarified in comments it's still running in foreground on an interactive shell, you should just be able to press Ctrl+Z. That will suspend the ./command job. Unless ./command actually ...
33 votes
Accepted

Is there a fastest way to shutdown the system?

It doesn't get much faster than using the System Request (SysRq) functionality and then triggering an immediate reboot. This is a key combination understood by the kernel. Enable SysRq: echo 1 > ...
  • 4,087
32 votes

How do I shut down a Linux server after running for 60 minutes?

This looks like an XY problem. My tasks take usually no more than 15 minutes. I would like to implement a mechanism to shutdown it automatically after 60 minutes. If you shut down after 60 minutes,...
  • 1,098
28 votes

How to disable shutdown so that an important process cannot be interrupted?

For newer systems with systemd this has been solved by systemd-inhibit. Example of usage: systemd-inhibit --why="Doing weekly backup" bash my-backups.sh Then, if a user attempts to shutdown it will ...
  • 1,502
28 votes

How to shutdown Linux at specific datetime from terminal?

No, you can't specify a date at the shutdown command, but two alternatives exist: The easiest is to use the at command.  The following example will execute shutdown +5 at a specific time and day: ...
  • 2,310
26 votes

What is the difference between these commands for bringing down a Linux server?

halt instructs the hardware to stop all CPU functions, but leaves it in a powered-on state. This usually means someone has to reboot or shut the machine down manually by pressing the power button ...
  • 28.6k
25 votes
Accepted

How to halt a script at a specific time until it is started again by cron?

You can run it with the timeout command, timeout - run a command with a time limit Synopsis timeout [OPTION] NUMBER[SUFFIX] COMMAND [ARG]... timeout [OPTION] Description Start COMMAND, and kill it ...
  • 3,678
24 votes
Accepted

message at shutdown: watchdog did not stop!

The watchdog did not stop! line is normal behavior. systemd sets a "hardware watchdog" timer as a failsafe, to ensure that if the normal shutdown process freezes/fails that the computer will still ...
  • 2,607
23 votes

What is the difference between shutdown 18:00 and at 18:00 shutdown?

And now, the systemd answer. If you have CentOS 7, you have a systemd operating system and the answer is different. at 18:00 shutdown now still schedules via the at subsystem, but that shutdown ...
  • 63.4k
22 votes
Accepted

How do I shut down a Linux server after running for 60 minutes?

If you execute your tasks as the same user every time, you can simply add the shutdown command, optionally with the option -P, to your profile. The number stands for the amount of minutes the shutdown ...
21 votes
Accepted

How can I shutdown a RHEL server at 06:45 tomorrow morning?

You can use shutdown: sudo shutdown -h 06:45 & And to check it: ps -aux | grep shutdown If you want to cancel it: sudo shutdown -c This assumes of course that the shutdown time has already ...
  • 3,826
19 votes

How to run a script with systemd right before shutdown?

To run a service right before starting any of reboot/shutdown/halt/kexec services (i.e. in the last moment before root filesystem becomes remounted read-only) use this service config: [Unit] ...
18 votes

Execute a command before shutdown

Now that the Ubuntu variants and Mint have moved to systemd I found my old solutions based on the above to be less satisfactory. I searched around the web to find out how to do it with systemd and ...
  • 296
18 votes
Accepted

shutdown, but still allow new logins

You could simply not use shutdown with a time specification, but echo shutdown -h now | at now + 5 minutes or similar; a simple sleep $((60*5)) ; shutdown -h now would do, too. However, using at has ...
17 votes

What is the difference between reboot , init 6 and shutdown -r now?

Shutdown is preferable because it allows you to specify the reason for the drastic action -- something you should always do. The message will be recorded in the log(s) for posterity. For example: ...
16 votes

systemd: How to check scheduled time of a delayed shutdown?

# cat /run/systemd/shutdown/scheduled USEC=1537242600000000 WARN_WALL=1 MODE=poweroff The USEC is a unix epoch timestamp with microsecond precision, so: if [ -f /run/systemd/shutdown/scheduled ]; ...
15 votes

Is there a shutdown/restart command for x11VNC? - Linux (Debian)

Since you know how to start the server, here is a way to gracefully stop it: x11vnc -R stop basically you send a remote command (see -remote) to the running instance.
  • 593
14 votes

Find last shutdown time

According to your output: shutdown system down 3.14-1-amd64 Mon Jul 21 08:43 - 22:19 (13:36) You shutdown your system on July 21 at 08:43 and then after 13 hours and 36 minutes on July 21 at ...

Only top scored, non community-wiki answers of a minimum length are eligible