summaryrefslogtreecommitdiff
path: root/skip/samba/samba.initd
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-02-02 14:10:02 +0000
committerdavidovski <david@davidovski.xyz>2023-02-02 14:10:02 +0000
commitf29d569cd33a73da5ad675f43a34ad53c5cc9bc6 (patch)
tree76fe6267f8307e7630fc6f53ff99a9767ad40de0 /skip/samba/samba.initd
parent05d004dfe0c9a9d898fac8a4a0292ca2a74ca391 (diff)
Work
Diffstat (limited to 'skip/samba/samba.initd')
-rw-r--r--skip/samba/samba.initd79
1 files changed, 79 insertions, 0 deletions
diff --git a/skip/samba/samba.initd b/skip/samba/samba.initd
new file mode 100644
index 0000000..71c7fb2
--- /dev/null
+++ b/skip/samba/samba.initd
@@ -0,0 +1,79 @@
+#!/sbin/openrc-run
+
+extra_started_commands="reload"
+piddir=${piddir:-"/run/samba"}
+
+DAEMON=${RC_SVCNAME#samba.}
+if [ "$DAEMON" != "$RC_SVCNAME" ]; then
+ daemon_list=$DAEMON
+fi
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath --directory "$piddir"
+}
+
+start_samba() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/samba -- \
+ ${samba_options:-"-D"}
+}
+
+stop_samba() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/samba.pid
+}
+
+start_smbd() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- \
+ ${smbd_options:-"-D"}
+}
+
+stop_smbd() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/smbd.pid
+}
+
+start_nmbd() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- \
+ ${nmbd_options:-"-D"}
+}
+
+stop_nmbd() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/nmbd.pid
+}
+
+start_winbindd() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/winbindd -- \
+ $winbindd_options
+}
+
+stop_winbindd() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/winbindd.pid
+}
+
+start() {
+ for i in $daemon_list; do
+ ebegin "Starting $i"
+ start_$i
+ eend $?
+ done
+}
+
+stop() {
+ for i in $daemon_list; do
+ ebegin "Stopping $i"
+ stop_$i
+ eend $?
+ done
+}
+
+reload() {
+ for i in $daemon_list; do
+ ebegin "Reloading $i"
+ killall -HUP $i
+ eend $?
+ done
+}
+