Server graceful reboot and shutdown

Graceful reboots and shutdowns are existing for soft closing of all write-to-disk operations. There are many OS critical write operations, for example MySQL. If you will apply hard reset you may get corruption databases in result. To avoid all these problems we recommend to use graceful reboot. The last thing every system administrator want to do is end up with corrupted data upon reboot and server databases malfunction.

How to call for this?

Commands will call the required run-levels at shutdown and or reboot either way.

shutdown -r 

This will reboot the server, it is the same thing provided you just call them ‘as is’ with no additional options.

Available options for reboot:

[[email protected] ~]# reboot --help
usage: reboot [-n] [-w] [-d] [-f] [-h] [-i]
        -n: don't sync before halting the system
        -f: force halt/reboot, don't call shutdown

Sensitive Databases

If you are actually worry about your databases and want to be doubly sure they are stopped correctly _before_ you go into reboot then you can apply the stop command directly.

/etc/init.d/mysql stop
/etc/init.d/mariadb stop

You will then get a confirmation that the services are stopped. Then you can type your favourite reboot or shutdown -r now command.

Please note: after reboot on starting up services you should check the restarted states of the services and correctness manually.

In CentOS starting mysql daemon is not so complicated
(Restarting the service creates a new entry called mysql.sock):

# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
# service mysqld start

Also you can check all by running the following command:

chkconfig --list 

This command will look down the list for everything you interested in and you should expect to see them ‘start’ at run-level 3 and ‘stop’ at run-level 6.

Looking for a custom solution?

Our technicians can provide you with the best custom made solutions on the market, no matter whether you're a small business or large enterprise.

Get in touch