diff options
| author | Eugen Wissner <belka@caraus.de> | 2025-06-14 22:13:48 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2025-06-14 22:13:48 +0200 |
| commit | 21efcfc5ef3466e4bbdb5758e9f21af14337e583 (patch) | |
| tree | 2834fcf761646e8fbda93f5e246188a5c2aae2a2 /rc.redis/redis/template | |
| parent | 22994bb8694b8aa8b1094f1e7f24f499816fa1a4 (diff) | |
| download | s6-21efcfc5ef3466e4bbdb5758e9f21af14337e583.tar.gz | |
Add templated redis
Diffstat (limited to 'rc.redis/redis/template')
| -rwxr-xr-x | rc.redis/redis/template/data/check | 7 | ||||
| -rw-r--r-- | rc.redis/redis/template/env/CMD | 1 | ||||
| -rw-r--r-- | rc.redis/redis/template/env/CMD_OPTS | 1 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/CMD | 1 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/CMD_OPTS | 1 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/LOGDIR_GROUP | 2 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/LOGDIR_OWNER | 2 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/LOGDIR_PATH | 2 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/LOGDIR_PERMS | 2 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/env/LOG_SCRIPT | 2 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/notification-fd | 1 | ||||
| -rwxr-xr-x | rc.redis/redis/template/log/run | 25 | ||||
| -rw-r--r-- | rc.redis/redis/template/log/type | 1 | ||||
| -rw-r--r-- | rc.redis/redis/template/notification-fd | 1 | ||||
| -rwxr-xr-x | rc.redis/redis/template/run | 17 | ||||
| -rw-r--r-- | rc.redis/redis/template/type | 1 |
16 files changed, 67 insertions, 0 deletions
diff --git a/rc.redis/redis/template/data/check b/rc.redis/redis/template/data/check new file mode 100755 index 0000000..8bdc4ba --- /dev/null +++ b/rc.redis/redis/template/data/check @@ -0,0 +1,7 @@ +#!/bin/execlineb -P + +redirfd -w 2 /dev/null +getcwd -E CWD +backtick -E port { basename $CWD } +backtick -En PING { redis-cli -p $port ping } +eltest $PING = PONG diff --git a/rc.redis/redis/template/env/CMD b/rc.redis/redis/template/env/CMD new file mode 100644 index 0000000..20a006a --- /dev/null +++ b/rc.redis/redis/template/env/CMD @@ -0,0 +1 @@ +redis-server diff --git a/rc.redis/redis/template/env/CMD_OPTS b/rc.redis/redis/template/env/CMD_OPTS new file mode 100644 index 0000000..35b0eaa --- /dev/null +++ b/rc.redis/redis/template/env/CMD_OPTS @@ -0,0 +1 @@ +/etc/redis/${port}.conf diff --git a/rc.redis/redis/template/log/env/CMD b/rc.redis/redis/template/log/env/CMD new file mode 100644 index 0000000..9d5239c --- /dev/null +++ b/rc.redis/redis/template/log/env/CMD @@ -0,0 +1 @@ +s6-log diff --git a/rc.redis/redis/template/log/env/CMD_OPTS b/rc.redis/redis/template/log/env/CMD_OPTS new file mode 100644 index 0000000..00d672e --- /dev/null +++ b/rc.redis/redis/template/log/env/CMD_OPTS @@ -0,0 +1 @@ +-d3 diff --git a/rc.redis/redis/template/log/env/LOGDIR_GROUP b/rc.redis/redis/template/log/env/LOGDIR_GROUP new file mode 100644 index 0000000..3794bcd --- /dev/null +++ b/rc.redis/redis/template/log/env/LOGDIR_GROUP @@ -0,0 +1,2 @@ +root +# Logging directory group ownership diff --git a/rc.redis/redis/template/log/env/LOGDIR_OWNER b/rc.redis/redis/template/log/env/LOGDIR_OWNER new file mode 100644 index 0000000..9f9fd12 --- /dev/null +++ b/rc.redis/redis/template/log/env/LOGDIR_OWNER @@ -0,0 +1,2 @@ +root +# Logging directory owner diff --git a/rc.redis/redis/template/log/env/LOGDIR_PATH b/rc.redis/redis/template/log/env/LOGDIR_PATH new file mode 100644 index 0000000..5bd5897 --- /dev/null +++ b/rc.redis/redis/template/log/env/LOGDIR_PATH @@ -0,0 +1,2 @@ +/var/log/redis/${port} +# Logging directory path diff --git a/rc.redis/redis/template/log/env/LOGDIR_PERMS b/rc.redis/redis/template/log/env/LOGDIR_PERMS new file mode 100644 index 0000000..ccece6e --- /dev/null +++ b/rc.redis/redis/template/log/env/LOGDIR_PERMS @@ -0,0 +1,2 @@ +750 +# Logging directory access rights in octal diff --git a/rc.redis/redis/template/log/env/LOG_SCRIPT b/rc.redis/redis/template/log/env/LOG_SCRIPT new file mode 100644 index 0000000..948a563 --- /dev/null +++ b/rc.redis/redis/template/log/env/LOG_SCRIPT @@ -0,0 +1,2 @@ +n4 s500000 T $LOGDIR_PATH +# Logging script used by s6-log diff --git a/rc.redis/redis/template/log/notification-fd b/rc.redis/redis/template/log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/rc.redis/redis/template/log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/rc.redis/redis/template/log/run b/rc.redis/redis/template/log/run new file mode 100755 index 0000000..f05f9eb --- /dev/null +++ b/rc.redis/redis/template/log/run @@ -0,0 +1,25 @@ +#!/bin/execlineb -WS1 + +############################################### +# Start a logging daemon for the redis daemon # +############################################### + +s6-envdir env +multisubstitute { + importas -iu LOGDIR_OWNER LOGDIR_OWNER + importas -iu LOGDIR_GROUP LOGDIR_GROUP + importas -iu LOGDIR_PERMS LOGDIR_PERMS + importas -iu CMD CMD + importas -usCd" " CMD_OPTS CMD_OPTS + importas -iusCd" " LOG_SCRIPT LOG_SCRIPT +} +s6-envuidgid -Bi ${LOGDIR_OWNER}:${LOGDIR_GROUP} +multisubstitute { + importas -iu LOGDIR_PATH LOGDIR_PATH + importas -iu UID UID + importas -iu GID GID +} +backtick -E port { dirname $1 } +if { install -dm $LOGDIR_PERMS -o $UID -g $GID $LOGDIR_PATH } +s6-setuidgid ${UID}:${GID} +exec -c $CMD $CMD_OPTS -- $LOG_SCRIPT diff --git a/rc.redis/redis/template/log/type b/rc.redis/redis/template/log/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rc.redis/redis/template/log/type @@ -0,0 +1 @@ +longrun diff --git a/rc.redis/redis/template/notification-fd b/rc.redis/redis/template/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/rc.redis/redis/template/notification-fd @@ -0,0 +1 @@ +3 diff --git a/rc.redis/redis/template/run b/rc.redis/redis/template/run new file mode 100755 index 0000000..cdd0b58 --- /dev/null +++ b/rc.redis/redis/template/run @@ -0,0 +1,17 @@ +#!/bin/execlineb -WS1 + +################################# +# Start redis (key-value store) # +################################# + +fdmove -c 2 1 +s6-envdir env +multisubstitute { + importas -iu CMD CMD + importas -usCd" " CMD_OPTS CMD_OPTS +} +prlimit --nofile=8192 +define port $1 +s6-notifyoncheck -d +s6-setuidgid redis +exec -c $CMD $CMD_OPTS diff --git a/rc.redis/redis/template/type b/rc.redis/redis/template/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rc.redis/redis/template/type @@ -0,0 +1 @@ +longrun |
