summaryrefslogtreecommitdiff
path: root/www/cblog/files/cblog.in
blob: 94accfc99908438a97bfc18f737cbbec58e12af2 (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
#!/bin/sh

# $FreeBSD$
#
# cblog.fcgi startup script
#
# PROVIDE: cblog
# REQUIRE: LOGIN
# KEYWORK: shutdown

# Add the following to /etc/rc.conf[.local] to enable this service
#
# cblog_enable=YES
#
# You can fine tune others variables too:
# cblog_fib="NONE"
# cblog_socket="unix:/var/run/cblog/cblog.sock"
# syntax can be : 
# unix:/patch/to/socket
# tcp:IP:PORT (ipv6 and ipv4 supported)
# Use cblog_user to run cblog as user

cblog_setfib() {
	sysctl net.fibs >/dev/null 2>&1 || return 0

	case "$cblog_fib" in
	[Nn][Oo][Nn][Ee])
		;;
	*)
		command="setfib -F ${cblog_fib} ${command}"
		;;
	esac
}

cblog_precmd() {
	cblog_setfib

	install -d -o $cblog_user -m 755 /var/run/cblog
}

. /etc/rc.subr

name="cblog"
rcvar=cblog_enable

command="%%PREFIX%%/libexec/cblog.fcgi"
start_precmd="cblog_precmd"

load_rc_config $name
cblog_enable=${cblog_enable:-"NO"}
cblog_fib=${cblog_fib:-"NONE"}
cblog_user=${cblog_user:-"root"}
cblog_socket=${cblog_socker:-"unix:/var/run/cblog/cblog.sock"}

command_args=${cblog_socket}

run_rc_command "$1"