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.
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
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:
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.