[[.|[up]]]
====== services ======
Services are scripts in /etc/init.d.
List all services with
service --status-all
To start/stop/restart/check the status of a service:
systemctl {start|stop|restart|status}
or
service {start|stop|restart|status}
New services can be added creating a script in /etc/init.d, for example:
#!/bin/sh
### BEGIN INIT INFO
# Provides: sdb1
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: mounts encrypted partition /dev/sdb1
### END INIT INFO
set -e
case "$1" in
start)
cryptsetup open /dev/sdb1 --type luks sdb1 && mount /dev/mapper/sdb1 /private && exit 0
;;
stop)
umount /private && cryptsetup close sdb1 && exit 0
;;
restart)
# do nothing
;;
status)
cryptsetup status sdb1
mount | grep sdb1
exit 0
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
exit 1
and then registering them:
update-rc.d sdb1 defaults
To remove, delete script from /etc/init.d, or disable with:
update-rc.d sdb1 remove