openwrt_archive/multimedia/gmediaserver/files/gmediaserver.init

28 lines
534 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50
BIN=gmediaserver
DEFAULT=/etc/default/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
start() {
mkdir -p $RUN_D
config_load gmediaserver
config_foreach start_service gmediaserver
}
start_service() {
local cfg="$1"
config_get content_directory "$cfg" content_directory
config_get interface "$cfg" interface
$BIN --background --interface=${interface:-br-lan} --pid-file=$PID_F ${content_directory:-/tmp}
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}