HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: //usr/syno/etc/iptables_time_ctrl.sh
#!/bin/sh
# Copyright (c) 2000-2013 Synology Inc. All rights reserved.
# For iptables rule
TIME_CTRL_TOOL="/usr/syno/sbin/synotimecontrol"
TIME_CTRL_TOOL_TMP="/tmp/synotimecontrol"
TIME_CTRL_CONF="/etc/parental/timectrl.conf"

# return:
# 0 - disable
# 1 - enable
is_time_ctrl_rule_enable()
{
	if [ ! -f ${TIME_CTRL_CONF} ]; then
		return 0
	fi

	return 1
}

startTimeCtrl()
{
	is_time_ctrl_rule_enable
	if [ $? -eq 1 ]; then
		/bin/cp -f ${TIME_CTRL_CONF} /tmp/
		/bin/cp -f ${TIME_CTRL_TOOL} ${TIME_CTRL_TOOL_TMP}
		${TIME_CTRL_TOOL_TMP} --apply
	fi
}

stopTimeCtrl()
{
	if [ -f ${TIME_CTRL_TOOL_TMP} ]; then
		${TIME_CTRL_TOOL_TMP} --disable
	fi
}

case "$1" in
	start)
		startTimeCtrl
	;;
	stop)
		stopTimeCtrl
	;;
	*)
		echo "Usage: $0 [start|stop]"
		exit 1
	;;
esac
exit 0