FreeBSD 6.4
вобщем делаю рестартилку для адсл мопеда dlink 2005U
наткнулся на скрипт http://chinmaykamat.blogspot.com/2008/11/script-to-restart-adsl-modem.html
#!/usr/bin/env python
#
# This script will ping to google.bg and if network is
# unreachable it will connect to the modem and reboot it.
import os
import commands
import pexpect
def adsl_reboot():
p = pexpect.spawn('telnet 192.168.1.1')
p.expect('Login: ')
p.sendline('admin') # Sending Username.
p.expect('Password: ')
p.sendline('admin') # Sending Password.
# print "loggedin",
p.expect('-> ')
p.sendline('12') # Sending command to the shell.
# p.expect('Save current configuration and reboot? Confirm [1-yes,2-no] ==> ')
p.sendline('1')
os.system('zenity --notification --text="The modem has been rebooted."')
# Show an icon in the notification area
result = commands.getoutput("ping -c 1 google.bg")
#if result.find("Unreachable") == -1:
# result = True
# print 'Connected!'
#else:
result = False
print 'Not connected! - Rebooting the modem.'
if result == False:
adsl_reboot()
#
# This was my first script.
# Author: Boris Bolgradov
#
# Big thanks to: walkerk, days_of_ruin and Psykotik!
ругается на
[root@mGate /home]# ./restart_adsl.py
File "./restart_adsl.py", line 8
p = pexpect.spawn('telnet 192.168.1.1')
^
IndentationError: expected an indented block
[root@mGate /home]#
в чем прикол? ОС frebsd 6.4
в питоне не силён =(