summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGravatar shtrophic2025-04-17 22:01:21 +0200
committerGravatar shtrophic2025-04-17 22:01:21 +0200
commitac8b03f9e96d5778b3c0ddfea94b54e17963a3d4 (patch)
treeb650f683bd6cea37e4d88ae247411f4f9edb2a32 /examples
parentMerge tag '2.74' into curl-smtp (diff)
parentVersion 2.75 RELEASED. (diff)
downloadsnac2-ac8b03f9e96d5778b3c0ddfea94b54e17963a3d4.tar.gz
snac2-ac8b03f9e96d5778b3c0ddfea94b54e17963a3d4.tar.xz
snac2-ac8b03f9e96d5778b3c0ddfea94b54e17963a3d4.zip
Merge tag '2.75' into curl-smtp
Diffstat (limited to 'examples')
-rw-r--r--examples/snac-admin51
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/snac-admin b/examples/snac-admin
new file mode 100644
index 0000000..e51e28b
--- /dev/null
+++ b/examples/snac-admin
@@ -0,0 +1,51 @@
1#!/usr/bin/env bash
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_DIR
9## down below according to your setup.
10##
11## USAGE
12## snac-admin state
13## snac-admin adduser rikkert
14## snac-admin block example.org
15## snac-admin verify_links lisa
16## ...
17##
18## Author: @chris@social.shtrophic.net
19##
20## Released into the public domain
21##
22
23set -e
24
25SNAC_PID=$(pidof snac)
26SNAC_DIR=/var/lib/snac
27
28SNAC_VERB=$1
29shift
30
31if [ -z $SNAC_PID ]; then
32 echo "no such process" >&2
33 exit 1
34fi
35
36if [ $(id -u) -ne 0 ]; then
37 echo "not root" >&2
38 exit 1
39fi
40
41if [ ! -d $SNAC_DIR ]; then
42 echo "$SNAC_DIR is not a directory" >&2
43 exit 1
44fi
45
46if [ -z $SNAC_VERB ]; then
47 echo "no arguments" >&2
48 exit 1
49fi
50
51nsenter -ae -S follow -G follow -t $SNAC_PID -- snac $SNAC_VERB $SNAC_DIR $@