Linux/Service Mgt

OpenRC

$ rc-update add <service> <runlevel>
$ rc-update del <service> <runlevel>
$ rc-service <service> <start stop restart>

$ rc-status
$ rc <runlevel>

$ reboot
$ halt      # Equivalent to shutdown -r now
$ poweroff  # Equivalent to shutdown -h now

Notes:

  1. Runlevels: default, hotplugged, manual

Service Files:

  • /etc/conf.d

  • /etc/init.d

References:

  1. OpenRC Homepage

  2. OpenRC Service Script Writing Guide

SystemD

$ systemctl start <service>
$ systemctl stop <service>
$ systemctl enable <service>
$ systemctl disenable <service>
$ systemctl is-enabled <service>
$ systemctl daemon-reload                           # Use when you create or modify a service file
$ systemctl list-unit-files | grep enabled          # List all enabled services

Service Files:

  • /etc/systemd/system

  • /etc/systemd/user

References:

  1. Systemd For Upstart Users