jellyfin/deployment/debian-package-x64/pkg-src/bin/restart.sh

21 lines
506 B
Bash
Raw Normal View History

2019-01-11 22:35:14 +00:00
#!/bin/bash
NAME=jellyfin
2019-02-04 05:26:23 +00:00
restart_cmds=(
"systemctl restart ${NAME}"
"service ${NAME} restart"
"/etc/init.d/${NAME} restart"
"s6-svc -t /var/run/s6/services/${NAME}"
)
2019-01-11 22:35:14 +00:00
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