aboutsummaryrefslogtreecommitdiff
path: root/utils/clixon/files/clixon.init
blob: edf9b1a60748c2221ba9f561445f08c49ae4e512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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"
}