summaryrefslogtreecommitdiff
path: root/ftp/fastdfs/files/fdfs_storaged.in
blob: 75099f4682147f0ad5ec05919d1ac3397bd57341 (plain) (blame)
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_storaged
# REQUIRE: LOGIN
# KEYWORD: shutdown

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

. /etc/rc.subr

name="fdfs_storaged"
rcvar=fdfs_storaged_enable

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

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

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

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

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

# read configuration and set defaults
load_rc_config "$name"
: ${fdfs_storaged_enable="NO"}
: ${fdfs_storaged_config="%%PREFIX%%/etc/fdfs/storage.conf"}

command_args="${fdfs_storaged_config}"
required_files="${fdfs_storaged_config}"

run_rc_command "$1"