Systemd system and services manager can be controlled using the systemctl command line utility. It enables you to manage systemd locally or on a remote Linux machine over the SSH protocol.

 

To connect to a remote server, run systemctl with the --host or -H flag as follows. In the command below, we are connecting to the remote server as the root user and status is a subcommand of systemctl utility used to view the status of the httpd service on centos.rootadminz.lan (remote Linux server).

$ systemctl --host root@centos.rootadminz.lan status httpd.service
OR
$ systemctl -H root@centos.rootadminz.lan status httpd.service

 

Similarly, you can also start, stop or restart remote systemd service as shown.

$ systemctl --host root@centos.rootadminz.lan start httpd.service   
$ systemctl --host root@centos.rootadminz.lan stop httpd.service
$ systemctl --host root@centos.rootadminz.lan restart httpd.service

 

To end the session, simply type [Ctrl+C]. For more information and usage options, see the systemctl man page:

$ man systemctl 

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)