From 359a28cef7a83783f73b0648d1af89ccd5794413 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Thu, 9 Jan 2020 14:15:55 +0100 Subject: [PATCH] expand sv.md --- distros/void/sv.md | 49 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/distros/void/sv.md b/distros/void/sv.md index f3b793e..4725832 100644 --- a/distros/void/sv.md +++ b/distros/void/sv.md @@ -1,12 +1,49 @@ -# Basics +# List Services -Services display in /var/service -sv up ssh -sv down ssh -sv restart ssh +All possible services are in: + +> ls /etc/sv + +The computer only uses those in /var/service, so symbolic links are made to start and stop services. + +> ls /var/service + +# Start Services + +Enable the sshd service, so that ssh will work every time you boot up: + +> sudo ln -s /etc/sv/sshd /var/service + +Then start the service: + +> sudo sv start sshd + +# Stop Services + +Stop `mpd` with: + +> sudo sv stop mpd + +And stop it starting at startup with: + +> sudo rm /var/service/mpd + +You can also just make a file called 'down': + +> sudo touch /var/service/mpd/down + +This means you can start and stop the service without making symbolic links, but mpd will be 'down' when the computer starts. # Making a Service -Look in the `/etc/sv` directory, then in the existing services' run files. +Look in the `/etc/sv` directory, then in the existing services' 'run' files. You'll find a simple dash script (therefore Posix compliant). +You can write your own, just stick in the shebang `#!/bin/sh`. + +If unsure, use `#!/bin/bash` as the first line. When Void Linux says `sh`, it means `dash` shell, not `bash`. + +Confirm the shell you'll use: + +> ls -l $(which sh) +