initial commit

This commit is contained in:
cuqmbr 2024-11-14 17:53:38 +02:00
commit e9f567a033
Signed by: cuqmbr
GPG Key ID: 0AA446880C766199
9 changed files with 60 additions and 0 deletions

1
README Normal file
View File

@ -0,0 +1 @@
See https://smarden.org/runit/ and `man 8 runit` for more extensive documentation

5
check Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# Logic to check if the service is running correctly
# Executed when sv check is issued
# Reposrts success when exit code is 0

2
conf Normal file
View File

@ -0,0 +1,2 @@
OPTS=""
VAR_NAME="VAR_VALUE"

1
env/ENV_VAR_NAME vendored Normal file
View File

@ -0,0 +1 @@
env_var_value

10
finish Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Execution finish point
# Executes on service shutdown
exec 2>&1; set -e
[ -r conf ] && . ./conf
exec /path/to/executable $OPTS

2
log/conf Normal file
View File

@ -0,0 +1,2 @@
LOGDIR="/home/cuqmbr/.local/runit/logs/template"
OPTS="-tt"

2
log/config Normal file
View File

@ -0,0 +1,2 @@
svlogd configuration file
see 'man svlogd(1)' for details

13
log/run Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Same as run in service directory except for the loggin
# See 'man svlogd(1)' for more info
exec 2>&1; set -e
[ -r conf ] && . ./conf
# If the directory doesn't exist create it with specified mod bits
[ -d "$LOGDIR" ] || /usr/bin/install -dm 755 "$LOGDIR"
exec /usr/bin/svlogd $OPTS "$LOGDIR"

24
run Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# Execution starting point
# This file must run the process in the foreground
# Redirect stderr to stdout
# Set strict mode. See 'set --help' for more info
exec 2>&1; set -e
# Source variables from ./conf
[ -r conf ] && . ./conf
exec /path/to/executable $OPTS
# Use instead of statement above if you need to use environment variables
#exec chpst -e env /path/to/executable $OPTS
# Use if you need service supervision but the programm doesnt execute much work (exit shortly after start)
# This way the service will have 'running' status and you will be able to stop which will execute finish file
# NOTE: argument is not supported with this method
#exec chpst -b /path/to/executable pause
# Same as above but with arguments support
#exec sh -c "/path/to/executable arguments; pause"