Repository navigation
Expand file tree
/
Copy pathcsf.sh
More file actions
103 lines (97 loc) · 2.48 KB
/
Copy pathcsf.sh
File metadata and controls
103 lines (97 loc) · 2.48 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
#
###############################################################################
# lfd
# Copyright (C) 2006-2025 Jonathan Michaelson
#
# https://github.com/waytotheweb/scripts
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <https://www.gnu.org/licenses>.
###############################################################################
#
# chkconfig: 2345 15 80
# description: ConfigServer Firewall
#
### BEGIN INIT INFO
# Provides: csf
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Start-Before: $syslog
# Short-Description: ConfigServer Firewall (csf)
# Description: ConfigServer Firewall (csf) init script
### END INIT INFO
#
[ -f /usr/sbin/csf ] || exit 0
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
DAEMON=/usr/sbin/csf
LOCKFILE=/var/lock/subsys/csf
if [ -f /etc/SuSE-release ]; then
. /etc/rc.status
rc_reset
fi
case "$1" in
start)
echo -n "Starting csf:"
$DAEMON --initup
if [ -f /etc/SuSE-release ]; then
rc_status -v
elif [ -f /etc/debian_version ] || [ -f /etc/lsb-release ] || [ -f /etc/gentoo-release ]; then
echo " Done"
else
success
echo
fi
echo
if [ -e /var/lock/subsys/ ]; then
touch $LOCKFILE
fi
;;
stop)
echo "WARNING: This script should ONLY be used by the init process. To restart csf use the CLI command 'csf -r'"
echo
echo -n "Stopping csf:"
$DAEMON --initdown
$DAEMON --stop > /dev/null 2>&1
if [ -f /etc/SuSE-release ]; then
rc_status -v
elif [ -f /etc/debian_version ] || [ -f /etc/lsb-release ] || [ -f /etc/gentoo-release ]; then
echo " Done"
else
success
echo
fi
echo
if [ -e /var/lock/subsys/ ]; then
rm -f $LOCKFILE
fi
;;
status)
echo -n "Status of csf:"
$DAEMON --status
echo
;;
restart|force-reload|reload)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/csf start|stop|restart|force-reload|status"
exit 1
esac
exit 0