View | Details | Raw Unified | Return to bug 198736 | Differences between
and this patch

Collapse All | Expand All

(-)files/smokeping.in (-11 / +38 lines)
Lines 24-29 Link Here
24
24
25
extra_commands="status configtest reload"
25
extra_commands="status configtest reload"
26
26
27
start_cmd="smokeping_start"
27
status_cmd="smokeping_status"
28
status_cmd="smokeping_status"
28
configtest_cmd="smokeping_configtest"
29
configtest_cmd="smokeping_configtest"
29
reload_cmd="smokeping_reload"
30
reload_cmd="smokeping_reload"
Lines 41-83 Link Here
41
pidfile="${smokeping_pidfile}"
42
pidfile="${smokeping_pidfile}"
42
command_interpreter="%%PREFIX%%/bin/perl"
43
command_interpreter="%%PREFIX%%/bin/perl"
43
44
44
smokeping_startprecmd()
45
smokeping_check_pidfile()
45
{
46
{
47
	rc_pid=$(check_pidfile $pidfile $command)
48
	if [ -z "${rc_pid}" ]; then
49
		rc_pid=$(check_pidfile $pidfile $command $command_interpreter)
50
	fi
51
}
52
53
smokeping_start()
54
{
55
	smokeping_check_pidfile
56
	if [ -n "$rc_pid" ]; then
57
		echo 1>&2 "${name} already running? (pid=$rc_pid)."
58
		return 1
59
	fi
60
46
	if [ ! -e ${smokeping_logfile} ];
61
	if [ ! -e ${smokeping_logfile} ];
47
	then
62
	then
48
		install -o %%USERS%% -g %%GROUPS%% /dev/null ${smokeping_logfile} || echo "ERROR: Could not initialize logfile at ${smokeping_logfile}.";
63
		install -o ${smokeping_user} -g ${smokeping_group} -m 644 /dev/null ${smokeping_logfile} ||\
64
			 echo "ERROR: Could not initialize logfile at ${smokeping_logfile}.";
49
	fi
65
	fi
66
67
	echo "Starting ${name}."
68
	${command} ${smokeping_flags} ${command_args}
50
}
69
}
51
70
52
smokeping_status()
71
smokeping_status()
53
{
72
{
54
	rc_pid=$(check_pidfile $pidfile $command)
73
	smokeping_check_pidfile
55
	if [ -z "$rc_pid" ]; then
74
	if [ -z "$rc_pid" ]; then
56
		_run_rc_notrunning
75
		echo "${name} is not running."
76
		return 1
57
	else
77
	else
58
		echo "${name} is running as pid $rc_pid"
78
		echo "${name} is running as pid $rc_pid"
59
        fi
79
	fi
60
}
80
}
61
81
62
smokeping_configtest()
82
smokeping_configtest()
63
{
83
{
64
	/usr/local/bin/smokeping --check
84
	${command} --check
65
}
85
}
66
86
67
smokeping_reload()
87
smokeping_reload()
68
{
88
{
69
	/usr/local/bin/smokeping --reload
89
	smokeping_check_pidfile
90
	if [ -z "$rc_pid" ]; then
91
		_run_rc_notrunning
92
		return 1
93
	else
94
		${command} --reload
95
	fi
70
}
96
}
71
97
72
smokeping_stop()
98
smokeping_stop()
73
{
99
{
74
	rc_pid=$(check_pidfile $pidfile $command)
100
	smokeping_check_pidfile
75
	if [ -z "$rc_pid" ]; then
101
	if [ -z "$rc_pid" ]; then
76
		_run_rc_notrunning
102
		_run_rc_notrunning
103
		return 1
77
	else
104
	else
78
		echo "Stopping ${name} (pid $rc_pid)."
105
		echo "Stopping ${name}."
79
		kill -15 $rc_pid
106
		kill -TERM $rc_pid
80
        fi
107
	fi
81
}
108
}
82
109
83
load_rc_config $name
110
load_rc_config $name

Return to bug 198736