aboutsummaryrefslogtreecommitdiffstats
path: root/community/runit/README.alpine
blob: e6b04f03e2d47d14175ab85c7ebf260ddc450679 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
For service supervision with runit:

(1) add scripts into /etc/sv/<service>/run

------------------------------
Example: /etc/sv/nginx/run   |
------------------------------
#!/bin/sh
mkdir -p /tmp/nginx
exec /usr/sbin/nginx
------------------------------
Example: /etc/sv/ssh/run     |
------------------------------
#!/bin/sh
set -e
ssh-keygen -A
exec /usr/sbin/sshd -D
------------------------------
Example: /etc/sv/mysqld/run  |
------------------------------
#!/bin/sh
libs=/var/lib/mysql
socket=/run/mysqld
mkdir -p $socket
chown mysql:mysql $socket
chown -R mysql:mysql $libs
exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
--------------------------------------------------
Example: /etc/sv/pgsql/run                       |
--------------------------------------------------
#!/bin/sh
. /etc/conf.d/postgresql
chown -R postgres:postgres ${PGDATA}
exec setuidgid postgres /usr/bin/postgres -D ${PGDATA} -o "$PGOPTS" 2>&1
---------------------------------------------------------------------------------
Example: /etc/sv/tinyssh/run                                                    |
---------------------------------------------------------------------------------
#!/bin/sh
PORT=22
mkdir -p /etc/tinyssh
/usr/sbin/tinysshd-makekey /etc/tinyssh/sshkeys 2>/dev/null
exec tcpserver -HRDl0 0.0.0.0 $PORT /usr/sbin/tinysshd -v -l /etc/tinyssh/sshkeys
---------------------------------------------------------------------------------

(2) set permissions:

chmod 700 /etc/sv/<service>/run

(3) symlink the script directory to the service directory:

ln -s /etc/sv/nginx /etc/service/nginx

==========================================================

The socklog package by the same author can provide logging
with built in log rotation & also be managed by runit.