openwrt-packages/utils/clixon/files/clixon.init

36 lines
708 B
Bash
Executable File

#!/bin/sh /etc/rc.common
START=95
STOP=05
USE_PROCD=1
PROG=/usr/sbin/clixon_backend
CONFIGFILE=/etc/clixon/clixon.xml
get_xmldb_dir() {
$PROG -F -f "$CONFIGFILE" -1 -l s -C text -s none \
| awk '/^ CLICON_XMLDB_DIR / { print substr($2, 0, length($2) - 1); }'
}
start_service() {
local state="init"
[ -f "$(get_xmldb_dir)/running_db" ] && state="running"
procd_open_instance
procd_set_param command "$PROG"
procd_set_param file $CONFIGFILE
procd_append_param command -F
procd_append_param command -f $CONFIGFILE
procd_append_param command -l s
procd_append_param command -s $state
procd_close_instance
}
stop_service() {
service_stop "$PROG"
}