分页: 1 / 1

控制上网时间

发表于 : 2008-06-28 9:44
baic
当然前提是用户不懂pon dsl-provider
在/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
改了点

发表于 : 2008-06-28 9:47
baic
刚写的没验证过

发表于 : 2008-06-28 10:12
linlee
挺好的~

发表于 : 2008-06-28 10:48
eexpress
这几句,怎么会要py的呢。

发表于 : 2008-06-28 11:11
baic
觉得python比较容易写一点