No mi sono spiegato male... io chiamo il comando "reboot&" ma poi non so come utilizzare uptime.. Riesci a fornirmi maggiori informazioni su come utilizzarlo o dove posso trovare maggiori info?
Il giorno 04 maggio 2011 12:59, Andrea Ambu <andrea...@gmail.com> ha scritto: > 2011/5/4 Andrea Tagliolini -Gmail <andreatagliol...@gmail.com>: > > cosa uptime? > > Ma scusa, dopo il reboot dove lo lanci uptime? > > > > Il 04/05/2011 12:36, Nicola Ferrari ha scritto: > > > > scau l'ignoranza... ma come funziona? E' un comando telnet? (giusto per > > capire dove documentarmi) > > > > Il giorno 04 maggio 2011 11:53, Andrea Tagliolini -Gmail > > <andreatagliol...@gmail.com> ha scritto: > >> > >> Puoi anche controllare con il comando uptime, a quanto corrisponde "la > >> vita" del router :) > >> > >> Il 04/05/2011 11:34, Nicola Ferrari ha scritto: > >> > >> Se riesco ci darò un occhiata... > >> Una domanda "teorica"... una volta che da telnet faccio "reboot", per > >> sapere se ha riavviato devo controllare se la rete è "su" giusto?? > >> solo che nel momento in cui faccio reboot al momento in cui la rete > >> "cade", passa un po' di tempo.. come faccio a risolvere? Faccio uno > sleep ? > >> Di quanti secondi? > >> > >> Il giorno 04 maggio 2011 10:45, Andrea Tagliolini -Gmail > >> <andreatagliol...@gmail.com> ha scritto: > >>> > >>> Ok, naturalmente puoi fare come vuoi :) > >>> Comunque ti dò un piccolo esempio di pexpect per fare un ping verso il > >>> dns di google nel router. > >>> > >>> import pexpect > >>> > >>> > >>> telnet = pexpect.spawn("telnet 192.168.1.1") > >>> telnet.expect("Login:") > >>> telnet.sendline("username del tuo router") > >>> telnet.expect("Password:") > >>> telnet.sendline("password_del tuo router") > >>> telnet.expect("#") > >>> telnet.senline("ping -c 5 8.8.8.8") > >>> telnet.expect("#") > >>> telnet.interact() > >>> > >>> L'ho scritto al volo e potrebbero esserci errori, però in generale > >>> funziona cosi. > >>> Io lo uso molto spesso in ambito lavorativo e funziona alla grande :) > >>> > >>> Ciao > >>> > >>> > >>> Il 04/05/2011 10:22, Nicola Ferrari ha scritto: > >>>> > >>>> Perchè non provi pexpect? > >>> > >>> Perchè telnetlib sembra più usata/documentata (almeno, visto i > risultati > >>> che mi fornisce google quando ricerco python+telnet). > >>> > >>> 2011/5/4 Andrea Tagliolini -Gmail <andreatagliol...@gmail.com> > >>>> > >>>> Perchè non provi pexpect? > >>>> > >>>> http://pexpect.sourceforge.net/pexpect.html > >>>> > >>>> Ciao > >>>> > >>>> Il 04/05/2011 10:00, Nicola Ferrari ha scritto: > >>>> > >>>> Buongiorno a tutti. > >>>> Tramite python (utilizzando l'esempio presente sulla documentazione > >>>> della libreria telnetlib) riesco a connettermi, tramite telnet, al mio > >>>> router. > >>>> Ecco il codice del mio file "test.py" > >>>> import getpass > >>>> import sys > >>>> import telnetlib > >>>> HOST = "192.168.1.2" > >>>> user = raw_input("Utente: ") > >>>> password = getpass.getpass() > >>>> tn = telnetlib.Telnet(HOST) > >>>> tn.read_until("login: ") > >>>> tn.write(user + "\n") > >>>> if password: > >>>> tn.read_until("Password: ") > >>>> tn.write(password + "\n") > >>>> tn.write("help \n") > >>>> tn.write("exit\n") > >>>> print tn.read_all() > >>>> > >>>> > >>>> Così facendo, mi vengono forniti tutti i possibili comandi che posso > >>>> lanciare. > >>>> ~ # help > >>>> Built-in commands: > >>>> ------------------- > >>>> . : break cd chdir continue eval exec exit export false hash > >>>> help local pwd read readonly return set shift source times > trap > >>>> true type ulimit umask unset wait [ [[ ash cat chgrp chmod > chown > >>>> cp date dd df echo egrep false fgrep free grep halt ifconfig > >>>> insmod kill killall klogd ln login ls lsmod mesg mkdir > modprobe > >>>> more mv netstat nslookup ping pivot_root poweroff ps pwd > reboot > >>>> rm rmdir rmmod route sh sleep sync syslogd tail telnetd test > >>>> tftp top touch traceroute true uname uptime vi watch wget who > >>>> whoami > >>>> > >>>> Non riesco a capire come funziona il "write": > >>>> - scrive tutto quanto e poi, una volta lanciato read_all esegue e > legge > >>>> i risultati > >>>> - esegue il comando fornito e il read_all legge solamente i > risultati?? > >>>> E' per capire come poter fare un ping (per esempio) > >>>> Grazie > >>>> > >>>> _______________________________________________ > >>>> Python mailing list > >>>> Python@lists.python.it > >>>> http://lists.python.it/mailman/listinfo/python > >>>> > >>>> > >>>> _______________________________________________ > >>>> Python mailing list > >>>> Python@lists.python.it > >>>> http://lists.python.it/mailman/listinfo/python > >>>> > >>> > >>> > >>> > >>> -- > >>> Nicola Ferrari > >>> website: http://www.nicolaferrari.name > >>> > >>> skype: nick.ferro > >>> > >>> > >>> _______________________________________________ > >>> Python mailing list > >>> Python@lists.python.it > >>> http://lists.python.it/mailman/listinfo/python > >>> > >>> > >>> _______________________________________________ > >>> Python mailing list > >>> Python@lists.python.it > >>> http://lists.python.it/mailman/listinfo/python > >>> > >> > >> > >> > >> -- > >> Nicola Ferrari > >> website: http://www.nicolaferrari.name > >> > >> skype: nick.ferro > >> > >> > >> _______________________________________________ > >> Python mailing list > >> Python@lists.python.it > >> http://lists.python.it/mailman/listinfo/python > >> > >> > >> _______________________________________________ > >> Python mailing list > >> Python@lists.python.it > >> http://lists.python.it/mailman/listinfo/python > >> > > > > > > > > -- > > Nicola Ferrari > > website: http://www.nicolaferrari.name > > > > skype: nick.ferro > > > > > > _______________________________________________ > > Python mailing list > > Python@lists.python.it > > http://lists.python.it/mailman/listinfo/python > > > > > > _______________________________________________ > > Python mailing list > > Python@lists.python.it > > http://lists.python.it/mailman/listinfo/python > > > > > > > > -- > Andrea > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python > -- Nicola Ferrari website: http://www.nicolaferrari.name skype: nick.ferro
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python