HEX
Server: Apache/2.4.63 (Unix)
System: Linux Synopilou92 4.4.302+ #72806 SMP Mon Jul 21 23:16:00 CST 2025 x86_64
User: pilou92 (1026)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /volume1/@appstore/MediaServer/scripts/S86synodms.sh
#!/bin/sh

PACKAGE_DIR="/var/packages/MediaServer"
dms="${PACKAGE_DIR}/target/sbin/dms"
lighttpd="${PACKAGE_DIR}/target/sbin/lighttpd"
httpconf="lighttpd.conf"
httpdebug="lighttpd.debug"
httpdpid=/var/run/lighttpd.pid
pidfile=/var/run/dms.pid
lighttpdlog=${PACKAGE_DIR}/var/log/lighttpd

dmsinfo="${PACKAGE_DIR}/etc/dmsinfo.conf"
LIGHTTPD_MODULE_DIR="${PACKAGE_DIR}/target/lib/lighttpd"
SYNOSYSTEMCTL="/usr/syno/bin/synosystemctl"

case $1 in
	start)
		echo "Starting Media Service ..."
		# lighttpd must be started after dms for getting ip from /var/run/dms.ip
		${SYNOSYSTEMCTL} start pkg-MediaServer-synodms.service

		DebugLevel=`/bin/get_key_value ${dmsinfo} loglevel_mediaservice`
		if [ "x${DebugLevel}" != "x" ]; then
			/bin/mkdir -p ${lighttpdlog}
			${SYNOSYSTEMCTL} start pkg-MediaServer-lighttpd@${httpdebug}.service
		else
			${SYNOSYSTEMCTL} start pkg-MediaServer-lighttpd@${httpconf}.service
		fi

        ;;
    stop)
		echo "Stopping Media Service ..."
		${SYNOSYSTEMCTL} stop pkg-MediaServer-synodms.service
		DebugLevel=`/bin/get_key_value ${dmsinfo} loglevel_mediaservice`
		if [ "x${DebugLevel}" != "x" ]; then
			${SYNOSYSTEMCTL} stop pkg-MediaServer-lighttpd@${httpdebug}.service
		else
			${SYNOSYSTEMCTL} stop pkg-MediaServer-lighttpd@${httpconf}.service
		fi
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 start|stop|restart"
        ;;
esac