summaryrefslogtreecommitdiff
path: root/mail/archiveopteryx-devel/files/archiveopteryx.in
blob: ad3426fb18ba512d0348948ced72d62b3f9d894c (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

# PROVIDE: archiveopteryx
# REQUIRE: login
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# archiveopteryx_enable (bool):	Set to NO by default.
#	Set it to YES to enable archiveopteryx.
#

. /etc/rc.subr

name=archiveopteryx
rcvar=archiveopteryx_enable

load_rc_config $name

archiveopteryx_enable=${archiveopteryx_enable:-"NO"}
pidfile=/var/run/${name}.pid
config_file=%%PREFIX%%/etc/archiveopteryx/archiveopteryx.conf
required_files=$config_file

command=%%PREFIX%%/bin/aox
extra_commands=status
status_cmd="${command} show status"
start_cmd=do_start
start_precmd=do_prestart
stop_cmd=do_stop
restart_cmd=do_restart

do_prestart()
{
	if [ ! -d /var/db/aox/jail ] ; then
		install -d -o root -g wheel -m 001 /var/db/aox/jail
	fi

	for i in /var/run/aox /var/db/aox/messages /var/db/aox/jail/var/run /var/db/aox/jail/messages ; do
		if [ ! -d ${i} ] ; then
			install -d -o aox -g aox ${i} ;
		fi
	done
}

do_start()
{
    echo -n "Starting Archiveopteryx: "
    ${command} start
    echo "done."
}

do_stop()
{
    echo -n "Stopping Archiveopteryx: "
    ${command} stop
    echo "done."
}

do_restart()
{
    echo -n "Restarting Archiveopteryx: "
    ${command} restart
    echo "done."
}

run_rc_command "$1"