source: src-sh/pbi-manager10/rc.d/pbid @ 651bd28

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 651bd28 was 651bd28, checked in by Kris Moore <kris@…>, 12 months ago

Add a new pbi-manager10 copy, this will be used for FreeBSD > 10

  • Property mode set to 100755
File size: 931 bytes
Line 
1#!/bin/sh
2#
3# PROVIDE: pbid
4# REQUIRE: DAEMON devd
5# KEYWORD: shutdown
6#
7# Add the following to /etc/rc.conf[.local] to enable this service
8#
9# pbid_enable="YES"
10#
11
12. /etc/rc.subr
13
14: ${pbid_enable="NO"}
15
16name=pbid
17rcvar=pbid_enable
18pidfile="/var/run/${name}.pid"
19
20command=/usr/local/sbin/pbid
21export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
22start_cmd="pbid_start"
23stop_cmd=pbid_stop
24
25pbid_start()
26{
27        if ! checkyesno pbid_enable ; then
28                return 0
29        fi
30
31        echo "Starting ${name}..."
32
33        # Source /etc/profile - in case user is using HTTP_PROXY
34        . /etc/profile >/dev/null 2>/dev/null
35        (nice $command) &
36        echo "$!" > ${pidfile}
37}
38
39pbid_stop()
40{
41        if ! checkyesno pbid_enable; then
42                return;
43        fi
44       
45        if [ ! -e "$pidfile" ] ; then
46                echo "No $pidfile, is $name running?"
47                return;
48        fi
49
50        echo "Stopping ${name}..."
51        kill -9 "`cat ${pidfile}`"
52        rm "${pidfile}"
53}
54
55
56load_rc_config ${name}
57run_rc_command "$1" 
Note: See TracBrowser for help on using the repository browser.