在/etc/rc.local中加入如下
$ cat /etc/rc.local
代码: 全选
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
python <<EOF
#coding:utf-8
import time,os
n=time.strftime('%k')
a=[i for i in range(8,22)]
if not int(n) in a:
os.system('poff dsl-provider')
print '现在不是上网时间'
EOF
at 22:30 <<EOF
poff dsl-provider
EOF
exit 0