lk/distros/void/sv.md

70 lines
1.2 KiB
Markdown
Raw Normal View History

2022-01-16 18:20:39 +00:00
---
title: "sv"
2023-01-06 20:13:45 +00:00
tags: [ "Documentation", "Void" ]
2022-01-16 18:20:39 +00:00
---
2020-01-09 13:15:55 +00:00
# List Services
2020-01-02 00:04:35 +00:00
2020-01-09 13:15:55 +00:00
All possible services are in:
```bash
ls /etc/sv
```
2020-01-09 13:15:55 +00:00
The computer only uses those in /var/service, so symbolic links are made to start and stop services.
```bash
ls /var/service
```
2020-01-09 13:15:55 +00:00
# Start Services
Enable the sshd service, so that ssh will work every time you boot up:
```bash
sudo ln -s /etc/sv/sshd /var/service
```
2020-01-09 13:15:55 +00:00
Then start the service:
```bash
sudo sv start sshd
```
2020-01-09 13:15:55 +00:00
# Stop Services
Stop `mpd` with:
```bash
sudo sv stop mpd
```
2020-01-09 13:15:55 +00:00
2022-05-20 17:04:51 +00:00
And stop it automatically loading at startup with:
2020-01-09 13:15:55 +00:00
```bash
sudo rm /var/service/mpd
```
2020-01-09 13:15:55 +00:00
You can also just make a file called 'down':
```bash
sudo touch /var/service/mpd/down
```
2020-01-09 13:15:55 +00:00
This means you can start and stop the service without making symbolic links, but mpd will be 'down' when the computer starts.
2020-01-02 00:04:35 +00:00
# Making a Service
2020-01-09 13:15:55 +00:00
Look in the `/etc/sv` directory, then in the existing services' 'run' files.
2020-01-02 00:04:35 +00:00
You'll find a simple dash script (therefore Posix compliant).
2020-01-09 13:15:55 +00:00
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:
```bash
ls -l $(which sh)
```
2020-01-09 13:15:55 +00:00