diff --git a/extra/mopidyctl/mopidyctl b/extra/mopidyctl/mopidyctl new file mode 100755 index 00000000..76d2fa63 --- /dev/null +++ b/extra/mopidyctl/mopidyctl @@ -0,0 +1,24 @@ +#!/bin/sh + +SELF=$(basename $0) +DAEMON="/usr/bin/mopidy" +DAEMON_USER="mopidy" +CONFIG_FILES="/usr/share/mopidy/conf.d:/etc/mopidy/mopidy.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 diff --git a/extra/mopidyctl/mopidyctl.8 b/extra/mopidyctl/mopidyctl.8 new file mode 100644 index 00000000..526165e9 --- /dev/null +++ b/extra/mopidyctl/mopidyctl.8 @@ -0,0 +1,17 @@ +.\" Manpage for mopidyctl +.TH "MOPIDYCTL" "8" "October 11, 2014" "1.0" "mopidyctl" +.SH NAME +mopidyctl \- manage the Mopidy music server system service +.SH SYNOPSIS +.B mopidyctl +[any mopidy(1) option] +.SH DESCRIPTION +The \fBmopidyctl\fP command runs \fBmopidy\fP subcommands in the +same environment as the Mopidy system service is running in. That is, as the +same user and with the same config as the Mopidy system service is using. +.SH OPTIONS +mopidyctl(8) takes the same options as mopidy(1). +.SH SEE ALSO +mopidy(1) +.SH COPYRIGHT +2014, Stein Magnus Jodal and contributors