In this tutorial, we explain the checklist for Pre and Post Linux Reboot. Every Linux admin should know what all action/checklist needs to be performed before/after the remote Linux server reboot.
Per-reboot checklist for remote Linux
- Note all running services on the Linux server, Optionally make sure the required service auto-start on boot.
- Check the current kernel version
- Check the External disk/Volume attached to a Linux server and add external disk entry in /etc/fstab (this will automount all disk after reboot)
- Sanity-check and save the NTP system time synchronized
- Make sure fsck won’t force check ext3/4 filesystem on boot
- Check If you have created any RAID either software/hardware Controller and check the RAID status
$ cat /proc/mdstat
- Check if you can shut down some of the services which will reduce system getting stuck on shutdown and it will quickly perform reboot operation
- Network traffic – this is Optional
Post-reboot checklist for remote Linux
- Verify the service with the list which you have taken on pre-reboot.
- Sanity-check – kernel version booted up, RAID status, system time, started service
- Check system logs – syslogs, error logs
The command which is required for pre- / post-Linux reboot is as followed
Command to check/list all running services:
For CentOS 6.x / RHEL 6.x or older
service --status-all service --status-all | more service --status-all | grep ntpd service --status-all | less
For CentOS 7/RHEL 7 using systemctl
# systemctl list-units --type=service OR # systemctl --type=service
Command to list all services which are active and exited on CentOS 7/RHEL 7
# systemctl list-units --type=service --state=active OR # systemctl --type=service --state=active
Command to list all services which are loaded and actively running services on CentOS 7/RHEL 7
# systemctl list-units --type=service --state=running OR # systemctl --type=service --state=running
Command to check Linux service status
For CentOS/RHEL 6.x or older
$ service <service-name> status
For example:
$ service httpd status
For CentOS/RHEL 7.X or Later
$ systemctl status <service-name>
Command to list all service in Linux
For CentOS/RHEL 6.x or older
$ chkconfig –list
For CentOS 7/RHEL 7 or later
→ systemctl replacements of legacy command service and chkconfig
List of active service units on CentOS 7/RHEL 7 or later:
systemctl list-units --type service
List of enabled/disabled status of all installed service units on CentOS 7/RHEL 7 or later:
# systemctl list-unit-files --type service
Command to list the Linux service with ports for CentOS/RHEL
$ netstat -tulpn
Read more on netstat and ss utility
Command to start/stop Linux service on boot:
For CentOS/RHEL 6.x or older
Syntax:
$ chkconfig <servicename> off $ chkconfig <servicename> on
For example:
$ chkconfig httpd off $ chkconfig httpd on
For CentOS 7/RHEL 7.x or later
If you are using the latest Linux distro such as CentOS/RHEL 7.X, Fedora 22/23/24 or later. Follow the mentioned command to list all running services using the systemctl command.
Enable auto-start a Linux service at boot on CentOS 7 / RHEL 7 or later:
# systemctl enable [service_name]
Disable auto-start a Linux service at boot on CentOS 7 / RHEL 7 or later:
# systemctl disable [service_name]
Command to list system services on CentOS/RHEL 7.x
systemctl systemctl | more systemctl | grep httpd systemctl list-units --type service systemctl list-units --type mount
To list all services:
$ systemctl list-unit-files $ chkconfig --list
This is the end of the tutorial, we listed some Checklist for Pre and Post Linux Reboot, If you found any new checklist please mention it in comment section below.
Read other articles hope you like them:
How to Mount AWS S3 Bucket on Linux Instance
Steps to connect Linux Server from windows using Putty
How to execute script or command on reboot or startup in Linux