diff options
| author | 2025-03-30 22:13:54 +0200 | |
|---|---|---|
| committer | 2025-03-30 22:13:54 +0200 | |
| commit | 84e72a52286db8e0af2d4a671f4b042d3e69f0d2 (patch) | |
| tree | 85d04478996d908016fd58dbdf19a3528d0253b5 | |
| parent | Merge pull request 'Added tittle text and class to custom emojis (issue #330)... (diff) | |
| download | penes-snac2-84e72a52286db8e0af2d4a671f4b042d3e69f0d2.tar.gz penes-snac2-84e72a52286db8e0af2d4a671f4b042d3e69f0d2.tar.xz penes-snac2-84e72a52286db8e0af2d4a671f4b042d3e69f0d2.zip | |
add snac-admin
| -rw-r--r-- | examples/snac-admin | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/snac-admin b/examples/snac-admin new file mode 100644 index 0000000..971618b --- /dev/null +++ b/examples/snac-admin | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #!/usr/bin/env fish | ||
| 2 | ## | ||
| 3 | ## SNAC-ADMIN | ||
| 4 | ## a simple script that is supposed to improve | ||
| 5 | ## a snac admin's life, especially when snac | ||
| 6 | ## is being run as a systemd.unit with | ||
| 7 | ## DynamicUser=yes enabled. | ||
| 8 | ## Please make sure to adjust SNAC_BASEDIR | ||
| 9 | ## down below according to your setup. | ||
| 10 | ## | ||
| 11 | ## USAGE | ||
| 12 | ## snac-admin state | ||
| 13 | ## snac-admin adduser rikkert | ||
| 14 | ## | ||
| 15 | ## Author: @chris@social.shtrophic.net | ||
| 16 | ## | ||
| 17 | ## Released into the public domain | ||
| 18 | ## | ||
| 19 | |||
| 20 | set -l SNAC_PID $(pidof snac) | ||
| 21 | set -l SNAC_BASEDIR /var/lib/snac | ||
| 22 | |||
| 23 | if test -z $SNAC_PID | ||
| 24 | echo "no such process" 1>&2 | ||
| 25 | exit 1 | ||
| 26 | end | ||
| 27 | |||
| 28 | if test $(id -u) -ne 0 | ||
| 29 | echo "not root" 1>&2 | ||
| 30 | exit 1 | ||
| 31 | end | ||
| 32 | |||
| 33 | if ! test -d $SNAC_BASEDIR | ||
| 34 | echo "$SNAC_BASEDIR does not exist" 1>&2 | ||
| 35 | exit 1 | ||
| 36 | end | ||
| 37 | |||
| 38 | if test -z $argv[1] | ||
| 39 | echo "no arguments" 1>&2 | ||
| 40 | exit 1 | ||
| 41 | end | ||
| 42 | |||
| 43 | nsenter -ae -S follow -G follow -t $SNAC_PID -- snac $argv[1] $SNAC_BASEDIR $argv[2..] | ||