NewLinuxInfo

From TheBestLinux.com
Jump to navigation Jump to search

Guides, Info & Tips on New Modern Linux Server Administration

Modern Server Administration of Critical Systems

This information pertains to very modern recent relases of Redhat based distributions, including the latest releases of CentOS and Fedora, which has had most of these service upgrades and replacements for the last few years now!



The first such service upgrade actually replaced most, if not all of the service init.d startup & shutdown scripts with a very different way of managing the startup, status and shutdown of services, such as the Apache webserver, the CUPS print server, the secure shell, aka the SSH server, and all of the other services that used to be controlled by shell scripts located in the /etc/init.d/ directory. This directory still exists so that in the event that an old legacy service needs to still be managed by the init.d shell scripts, due to the service not yet having the required setup to be managed by the replacement of all of those scripts:



systemctl



For instance, here is an example of systemctl being used to query the Secure Shell Server(SSH):

[root@fc24 ~]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor pres
   Active: active (running) since Sun 2016-09-11 01:12:21 PDT; 1h 20min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 791 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=0/SUCCE
 Main PID: 810 (sshd)
    Tasks: 1 (limit: 512)
   CGroup: /system.slice/sshd.service
           └─810 /usr/sbin/sshd

Sep 11 01:12:20 fc24.dawgland.com systemd[1]: Starting OpenSSH server daemon.
Sep 11 01:12:21 fc24.dawgland.com systemd[1]: sshd.service: PID file /var/run
Sep 11 01:12:21 fc24.dawgland.com sshd[810]: Server listening on 0.0.0.0 port
Sep 11 01:12:21 fc24.dawgland.com systemd[1]: Started OpenSSH server daemon.
lines 1-15/15 (END)



This is what is looks like after stopping the SSH server:

[root@fc24 ~]# systemctl stop sshd.service
[root@fc24 ~]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor pres
   Active: inactive (dead) since Sun 2016-09-11 02:38:55 PDT; 10s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 791 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=0/SUCCE
 Main PID: 810 (code=exited, status=0/SUCCESS)

Sep 11 01:12:20 fc24.dawgland.com systemd[1]: Starting OpenSSH server daemon.
Sep 11 01:12:21 fc24.dawgland.com systemd[1]: sshd.service: PID file /var/run
Sep 11 01:12:21 fc24.dawgland.com sshd[810]: Server listening on 0.0.0.0 port
Sep 11 01:12:21 fc24.dawgland.com systemd[1]: Started OpenSSH server daemon.
Sep 11 02:38:55 fc24.dawgland.com systemd[1]: Stopping OpenSSH server daemon.
Sep 11 02:38:55 fc24.dawgland.com systemd[1]: Stopped OpenSSH server daemon.
lines 1-14/14 (END)



And this is the command to start it back up, and because there is no output after starting it, I've also included the output of the status once again after starting the Secure Shell Server back up:
[root@fc24 ~]# systemctl start sshd.service
[root@fc24 ~]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor pres
   Active: active (running) since Sun 2016-09-11 02:42:38 PDT; 9s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 2801 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=0/SUCC
 Main PID: 2803 (sshd)
    Tasks: 1 (limit: 512)
   CGroup: /system.slice/sshd.service
           └─2803 /usr/sbin/sshd

Sep 11 02:42:38 fc24.dawgland.com systemd[1]: Starting OpenSSH server daemon.
Sep 11 02:42:38 fc24.dawgland.com systemd[1]: sshd.service: PID file /var/run
Sep 11 02:42:38 fc24.dawgland.com sshd[2803]: Server listening on 0.0.0.0 por
Sep 11 02:42:38 fc24.dawgland.com systemd[1]: Started OpenSSH server daemon.
lines 1-15/15 (END)