parent
21098eb861
commit
0bb08b3f8d
@ -0,0 +1,37 @@
|
||||
#Allow jellyfin group to start, stop and restart itself
|
||||
Cmnd_Alias RESTARTSERVER_SYSV = /sbin/service jellyfin restart, /usr/sbin/service jellyfin restart
|
||||
Cmnd_Alias STARTSERVER_SYSV = /sbin/service jellyfin start, /usr/sbin/service jellyfin start
|
||||
Cmnd_Alias STOPSERVER_SYSV = /sbin/service jellyfin stop, /usr/sbin/service jellyfin stop
|
||||
Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart jellyfin, /bin/systemctl restart jellyfin
|
||||
Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemctl start jellyfin
|
||||
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
|
||||
Cmnd_Alias RESTARTSERVER_INITD = /etc/init.d/jellyfin restart
|
||||
Cmnd_Alias STARTSERVER_INITD = /etc/init.d/jellyfin start
|
||||
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/jellyfin stop
|
||||
|
||||
|
||||
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
|
||||
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_INITD
|
||||
%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_INITD
|
||||
|
||||
Defaults!RESTARTSERVER_SYSV !requiretty
|
||||
Defaults!STARTSERVER_SYSV !requiretty
|
||||
Defaults!STOPSERVER_SYSV !requiretty
|
||||
Defaults!RESTARTSERVER_SYSTEMD !requiretty
|
||||
Defaults!STARTSERVER_SYSTEMD !requiretty
|
||||
Defaults!STOPSERVER_SYSTEMD !requiretty
|
||||
Defaults!RESTARTSERVER_INITD !requiretty
|
||||
Defaults!STARTSERVER_INITD !requiretty
|
||||
Defaults!STOPSERVER_INITD !requiretty
|
||||
|
||||
#Allow the server to mount iso images
|
||||
%jellyfin ALL=(ALL) NOPASSWD: /bin/mount
|
||||
%jellyfin ALL=(ALL) NOPASSWD: /bin/umount
|
||||
|
||||
Defaults:%jellyfin !requiretty
|
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
NAME=jellyfin
|
||||
|
||||
restart_cmds=("s6-svc -t /var/run/s6/services/${NAME}" \
|
||||
"systemctl restart ${NAME}" \
|
||||
"service ${NAME} restart" \
|
||||
"/etc/init.d/${NAME} restart")
|
||||
|
||||
for restart_cmd in "${restart_cmds[@]}"; do
|
||||
cmd=$(echo "$restart_cmd" | awk '{print $1}')
|
||||
cmd_loc=$(command -v ${cmd})
|
||||
if [[ -n "$cmd_loc" ]]; then
|
||||
restart_cmd=$(echo "$restart_cmd" | sed -e "s%${cmd}%${cmd_loc}%")
|
||||
echo "sleep 2; sudo $restart_cmd > /dev/null 2>&1" | at now > /dev/null 2>&1
|
||||
exit 0
|
||||
fi
|
||||
done
|
Loading…
Reference in new issue