summaryrefslogtreecommitdiff
path: root/ftp/fastdfs/files/fdfs_trackerd.in
blob: 82e8973c034f669791c4ae522febfc819055b25d (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
36
37
38
39
40
41
42
43
44
#!/bin/sh

# PROVIDE: fdfs_trackerd
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable `fdfs_trackerd':
#
# fdfs_trackerd_enable="YES"
#

. /etc/rc.subr

name="fdfs_trackerd"
rcvar=fdfs_trackerd_enable

command="%%PREFIX%%/bin/fdfs_trackerd"
pidfile="/var/run/fdfs_trackerd.pid"

start_postcmd="${name}_poststart"
stop_postcmd="rm ${pidfile}"

fdfs_trackerd_poststart()
{
        /bin/ps auxwww|/usr/bin/grep fdfs_trackerd|/usr/bin/grep -v 'grep'|grep -v 'rc.d'|/usr/bin/awk '{print $2;}' > /var/run/fdfs_trackerd.pid

        currpid=`/bin/cat /var/run/fdfs_trackerd.pid`

        if [ "$currpid" -gt 0 ]; then
                echo "Started fdfs_trackerd."
        fi
}

# read configuration and set defaults
load_rc_config "$name"
: ${fdfs_trackerd_enable="NO"}
: ${fdfs_trackerd_config="%%PREFIX%%/etc/fdfs/tracker.conf"}

command_args="${fdfs_trackerd_config}"
required_files="${fdfs_trackerd_config}"

run_rc_command "$1"