codekasten/web-splash/web-splash.sh

57 lines
1.2 KiB
Bash
Raw Normal View History

2005-05-17 01:37:23 +02:00
#!/bin/sh
2005-05-18 18:21:54 +02:00
#
# this skript is GPL software (http://www.fsf.org/licensing/licenses/gpl.html)
# suggestions and questions to: devel@sumpfralle.de
# homepage: https://systemausfall.org/toolforge/web-splash
#
2005-05-17 01:37:23 +02:00
2005-05-17 12:11:28 +02:00
set -ue
2005-05-17 01:37:23 +02:00
2005-05-17 02:26:11 +02:00
. /etc/web-splash.conf
2005-05-18 19:59:14 +02:00
. "$SPLASH_LIB/web-splash-functions.inc"
2005-05-17 01:37:23 +02:00
# check for DEBUG mode
[ "$SPLASH_DEBUG" -eq 1 ] && set -x
2005-05-17 01:37:23 +02:00
ACTION="--help"
[ $# -gt 0 ] && ACTION="$1"
case "$ACTION" in
start|restart )
remove_old
init_chains
;;
stop )
remove_old
;;
2005-05-17 02:26:11 +02:00
register )
[ $# -gt 2 ] && echo "[WEB_SPLASH] too many parameters: only one IP address is allowed" && exit 1
[ $# -lt 2 ] && echo "[WEB_SPLASH] you have to specify an IP address" && exit 2
register_IP "$2"
;;
2005-05-18 20:10:32 +02:00
unregister )
[ $# -gt 2 ] && echo "[WEB_SPLASH] too many parameters: only one IP address is allowed" && exit 1
[ $# -lt 2 ] && echo "[WEB_SPLASH] you have to specify an IP address" && exit 2
unregister_IP "$2"
;;
2005-05-17 02:26:11 +02:00
update )
2005-05-18 19:53:05 +02:00
update_IP_list
;;
traffic )
if [ $# -eq 1 ]
then get_IP_list | while read IP
2005-05-18 19:59:14 +02:00
do echo "$IP `get_IP_traffic \"$IP\"`"
2005-05-18 19:53:05 +02:00
done
else IP="$2"
2005-05-18 19:59:14 +02:00
get_IP_traffic "$IP"
2005-05-18 19:53:05 +02:00
fi
2005-05-17 02:26:11 +02:00
;;
2005-05-17 01:37:23 +02:00
* )
2005-05-18 20:10:32 +02:00
echo "Syntax: $0 {start|stop|restart|register|unregister|update|traffic}"
2005-05-17 01:37:23 +02:00
echo
;;
esac