Friday, August 9, 2013

Fedora 19 sytemctl

systemctl works with not only services but all other unit types, and is a valuable tool when monitoring or troubleshooting a system. It can list all known units, limit the results to a single unit type, show only failed units, or examine unit relationships. The table below shows some useful systemctl features and should help system administrators replace their old workflow in sysVinit.
systemctl command reference
sysVinit commandsystemd commandNotes
service sshd start systemctl start sshd.service Used to start a service (not reboot persistent)
service sshd stop systemctl stop sshd.service Used to stop a service. (not reboot persistent)
service sshd restart systemctl restart sshd.service Used to start and stop a service.
service sshd reload systemctl reload sshd.service When supported, reloads the config file without interrupting pending operations.
service sshd condrestart   systemctl condrestart sshd.service Restarts if the service is already running.
service sshd status systemctl status sshd.service Tells whether a service is currently running.
ls /etc/rc.d/init.d/ systemctl list-unit-files --type=service Lists all available services.
chkconfig sshd on systemctl enable sshd.service Always run the service at this target (runlevel.)
chkconfig sshd off systemctl disable sshd.service Do not automatically run the service at this target (runlevel.)
chkconfig --list systemctl list-units -t service --all Print a table of available services and their status.
chkconfig sshd --list ls /etc/systemd/system/*.wants/sshd.service Lists the targets that will include the service.
chkconfig sshd --add systemctl daemon-reload Used when you create a service file or modify any configuration.
telinit 3 systemctl isolate multi-user.target Move system into another target (change runlevels.)
[no comparable command] systemctl show -p "Wants" multi-user.target Lists units pulled in by a given target.
[no comparable command] systemctl show -p "After" sshd.service Shows dependent services and other targets.
[no comparable command] systemd --test --system --unit=multi-user.target Simulates booting the system to a given target
[no comparable command] systemd-analyze plot > boot.svg Generates a diagnostically useful graphical representation of the boot process.
ps xawf -eo pid,user,cgroup,args systemd-cgls Display control group process tree.

No comments: