diff options
author | Guillermo Ramos | 2023-08-26 13:53:59 +0200 |
---|---|---|
committer | Guillermo Ramos | 2023-08-26 13:53:59 +0200 |
commit | 819fcfab2a16d38c4449fc693c60d9b2fa5f3bcb (patch) | |
tree | c2dcebf1b9de69626b1f4de92db221447e5a4fb0 | |
parent | 1c38c0ce7d8fb66bd67e517f4dc4313526bea5cd (diff) | |
download | s6-services-819fcfab2a16d38c4449fc693c60d9b2fa5f3bcb.tar.gz |
Add OpenRC helper to launch users S6
-rw-r--r-- | s6-svscan-user.openrc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/s6-svscan-user.openrc b/s6-svscan-user.openrc new file mode 100644 index 0000000..c6a94e2 --- /dev/null +++ b/s6-svscan-user.openrc @@ -0,0 +1,40 @@ +#!/sbin/openrc-run +# Copyright (c) 2020-2023 Guillermo Ramos. +# See the Authors file at the top-level directory of this distribution and +# https://github.com/OpenRC/openrc/blob/master/AUTHORS +# +# This file is part of OpenRC. It is subject to the license terms in +# the LICENSE file found in the top-level directory of this +# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE +# This file may not be copied, modified, propagated, or distributed +# except according to the terms contained in the LICENSE file. + + +USER=${RC_SVCNAME#*.} +SVDIR=/home/$USER/s6/service + +description="Launch $USER's s6 services" +command=/bin/s6-svscan +command_args=$SVDIR +command_background=yes +command_user=$USER +pidfile=/var/run/s6-svscan-user.pid +output_log=/home/$USER/s6/s6-svscan-user.log +error_log=/home/$USER/s6/s6-svscan-user.error.log + +depend() +{ + need localmount +} + +stop_post() +{ + ebegin "Waiting for any remaining s6 services" + echo $SVDIR/* | xargs -n 1 -P 0 runuser -u $USER -- s6-svc -wD + eend $? + + ebegin "Waiting for any remaining s6 service loggers" + echo $SVDIR/*/log | xargs -n 1 -P 0 runuser -u $USER -- s6-svc -wD + eend $? + true +} |