1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mopidy_ynh.git synced 2024-09-03 19:46:21 +02:00
mopidy_ynh/sources/extra_files/mopidyctl

24 lines
553 B
Bash

#!/bin/sh
SELF=$(basename $0)
DAEMON="__INSTALL_DIR__/venv/bin/mopidy"
DAEMON_USER="__APP__"
CONFIG_FILES="__INSTALL_DIR__/__APP__.conf"
CMD="$DAEMON --config $CONFIG_FILES $@"
if [ $# -eq 0 ]; then
echo "Usage: $SELF [options]" 1>&2
echo "Examples:" 1>&2
echo " $SELF --help" 1>&2
echo " $SELF config" 1>&2
echo " $SELF local scan" 1>&2
exit 1
fi
if [ $(id -u) -ne 0 ]; then
echo "$SELF must be run as root" 1>&2
exit 2
fi
echo "Running \"$CMD\" as user $DAEMON_USER" 1>&2
su -s /bin/sh -c "$CMD" -- $DAEMON_USER