File: init.d.freebsd

package info (click to toggle)
syslog-ng 4.8.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,456 kB
  • sloc: ansic: 177,631; python: 13,035; cpp: 11,611; makefile: 7,012; sh: 5,147; java: 3,651; xml: 3,344; yacc: 1,377; lex: 599; perl: 193; awk: 190; objc: 162
file content (90 lines) | stat: -rw-r--r-- 2,110 bytes parent folder | download | duplicates (10)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh

# startup script for FreeBSD 6.x.
# Written by Tamas Pal <folti@balabit.hu>

# PROVIDE: syslogd
# REQUIRE: mountcritremote cleanvar newsyslog
# BEFORE: SERVERS

# Enabling syslog-ng:
# * copy this script to /etc/rc.d or /usr/local/etc/rc.d
# * Edit /etc/rc.conf and add the following lines:
#   ----- CUT HERE ----- 
# syslogd_enable="NO"
# syslogng_enable="YES"
# syslogng_flags=""
#   ----- CUT HERE ----- 
# * Add your extra flags to syslogng_flags EXCEPT the -p <pidfile> and -f
#   <conffile> flags. These are added automatically by this script. To set
#   their value, change the value of the conf_file and pidfile variables below

# BalaBit's platform independent variables. Please do not modify. 
SYSLOGNG_PREFIX=/opt/syslog-ng

. "/etc/rc.subr"


# FreeBSD rc specific variables. Please do not modify. 
name="syslogng"
rcvar=`set_rcvar`
pidfile="$SYSLOGNG_PREFIX/var/run/syslog-ng.pid"
command="$SYSLOGNG_PREFIX/sbin/syslog-ng"
required_files="$SYSLOGNG_PREFIX/etc/syslog-ng.conf"

start_precmd="syslog_ng_start_precmd"
start_postcmd="syslog_ng_start_postcmd"
stop_postcmd="syslog_ng_stop_postcmd"
reload_precmd="syslog_ng_reload_precmd"
extra_commands="reload"

# get original syslog pidfile from initscript.
_syslogd_pidfile=`sed -n -e 's/^pidfile="\([^"]*\)"/\1/p' /etc/rc.d/syslogd 2> /dev/null`
syslog_ng_start_precmd() {
	if [ ! -L /dev/log ]; then
		ln -s /var/run/log /dev/log
	fi
}

syslog_ng_reload_precmd() {
	$command --syntax-only
	_rval=$?
	if [ $_rval -ne 0 ];then
		exit $_rval
	fi
}

syslog_ng_start_postcmd() {
	if [ -n "$_syslogd_pidfile" ]; then
		# remove symlinks
		if [ -h $_syslogd_pidfile ]; then
			rm -f $_syslogd_pidfile
		fi
		if [ ! -f $_syslogd_pidfile ]; then
			ln -s "$pidfile" "$_syslogd_pidfile"
		fi
	fi
}

syslog_ng_stop_postcmd() {
	if [ -n "$_syslogd_pidfile" ]; then
		if [ -h $_syslogd_pidfile ]; then
			rm -f "$_syslogd_pidfile"
		fi
	fi
}

load_rc_config "$name"

case $1 in
	start)
		# Reportedly needed on 7.x.
		PATH=$PATH:$SYSLOGNG_PREFIX/sbin
		export PATH
		syslogng_flags="${syslog_ng_flags}"
	;;
esac

run_rc_command "$1"

# vim: ft=sh