Subversion Repositories ALCASAR

Rev

Rev 2387 | Rev 2395 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2387 Rev 2394
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2387 2017-08-22 16:43:03Z tom.houdayer $ 
2
#  $Id: alcasar.sh 2394 2017-08-27 13:28:59Z tom.houdayer $ 
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
 
5
 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...] 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...] 
7
# Ce programme est un logiciel libre ; This software is free and open source
7
# Ce programme est un logiciel libre ; This software is free and open source
Line 1172... Line 1172...
1172
[ -f /usr/sbin/chilli ] || exit 0
1172
[ -f /usr/sbin/chilli ] || exit 0
1173
. /etc/init.d/functions
1173
. /etc/init.d/functions
1174
CONFIG=/etc/chilli.conf
1174
CONFIG=/etc/chilli.conf
1175
pidfile=/var/run/chilli.pid
1175
pidfile=/var/run/chilli.pid
1176
[ -f \$CONFIG ] || {
1176
[ -f \$CONFIG ] || {
1177
    echo "\$CONFIG Not found"
1177
	echo "\$CONFIG Not found"
1178
    exit 0
1178
	exit 0
1179
}
1179
}
1180
current_users_file="/var/tmp/havp/current_users.txt"	# file containing active users
1180
current_users_file="/var/tmp/havp/current_users.txt"	# file containing active users
1181
RETVAL=0
1181
RETVAL=0
1182
prog="chilli"
1182
prog="chilli"
1183
case \$1 in
1183
case \$1 in
1184
    start)
1184
	start)
1185
	if [ -f \$pidfile ] ; then 
1185
		if [ -f \$pidfile ] ; then 
1186
		gprintf "chilli is already running"
1186
			gprintf "chilli is already running"
1187
	else
1187
		else
1188
        	gprintf "Starting \$prog: "
1188
			gprintf "Starting \$prog: "
1189
		[ -e \$current_users_file ] && echo '' > \$current_users_file
1189
			echo '' > \$current_users_file && chown apache:apache \$current_users_file
1190
		rm -f /var/run/chilli* # cleaning
1190
			rm -f /var/run/chilli* # cleaning
1191
        	/usr/sbin/modprobe tun >/dev/null 2>&1
1191
			/usr/sbin/modprobe tun >/dev/null 2>&1
1192
        	echo 1 > /proc/sys/net/ipv4/ip_forward
1192
			echo 1 > /proc/sys/net/ipv4/ip_forward
1193
		[ -e /dev/net/tun ] || {
1193
			[ -e /dev/net/tun ] || {
1194
	    	(cd /dev; 
1194
				(cd /dev; 
1195
			mkdir net; 
1195
				mkdir net; 
1196
			cd net; 
1196
				cd net; 
1197
			mknod tun c 10 200)
1197
				mknod tun c 10 200)
1198
		}
1198
			}
1199
		ifconfig $INTIF 0.0.0.0
1199
			ifconfig $INTIF 0.0.0.0
1200
		/usr/sbin/ethtool -K $INTIF gro off
1200
			/usr/sbin/ethtool -K $INTIF gro off
1201
		daemon /usr/sbin/chilli -c \$CONFIG --pidfile=\$pidfile &
1201
			daemon /usr/sbin/chilli -c \$CONFIG --pidfile=\$pidfile &
1202
        	RETVAL=\$?
1202
			RETVAL=\$?
1203
	fi
1203
		fi
1204
	;;
1204
		;;
1205
 
1205
 
1206
    reload)
1206
	reload)
1207
	killall -HUP chilli
1207
		killall -HUP chilli
1208
	;;
1208
		;;
1209
 
1209
 
1210
    restart)
1210
	restart)
1211
	\$0 stop
1211
		\$0 stop
1212
        sleep 2
1212
		sleep 2
1213
	\$0 start
1213
		\$0 start
1214
	;;
1214
		;;
1215
    
1215
 
1216
    status)
1216
	status)
1217
        status chilli
1217
		status chilli
1218
        RETVAL=0
1218
		RETVAL=0
1219
        ;;
1219
		;;
1220
 
1220
 
1221
    stop)
1221
	stop)
1222
	if [ -f \$pidfile ] ; then  
1222
		if [ -f \$pidfile ] ; then  
1223
        	gprintf "Shutting down \$prog: "
1223
			gprintf "Shutting down \$prog: "
1224
		killproc /usr/sbin/chilli
1224
			killproc /usr/sbin/chilli
1225
		RETVAL=\$?
1225
			RETVAL=\$?
1226
		[ \$RETVAL = 0 ] && rm -f \$pidfile
1226
			[ \$RETVAL = 0 ] && rm -f \$pidfile
1227
		[ -e \$current_users_file ] && rm -f \$current_users_file
1227
			[ -e \$current_users_file ] && rm -f \$current_users_file
1228
	else	
1228
		else	
1229
        	gprintf "chilli is not running"
1229
			gprintf "chilli is not running"
1230
	fi
1230
		fi
1231
	;;
1231
		;;
1232
    
1232
 
1233
    *)
1233
	*)
1234
        echo "Usage: \$0 {start|stop|restart|reload|status}"
1234
		echo "Usage: \$0 {start|stop|restart|reload|status}"
1235
        exit 1
1235
		exit 1
1236
esac
1236
esac
1237
echo
1237
echo
1238
EOF
1238
EOF
1239
	chmod a+x /etc/init.d/chilli
1239
	chmod a+x /etc/init.d/chilli
1240
	ln -s /etc/init.d/chilli /usr/libexec/chilli
1240
	ln -s /etc/init.d/chilli /usr/libexec/chilli