Как я могу подключить повторную попытку Empathy, когда у вас есть сетевая проблема

Вот два способа

С экраном

: Приложить сеанс экрана к вашим хронам:

экрана RSync --progress ЦСИ ДСТ

это позволит вам повторно прикрепить к Rsync jobb в любое время вы хотите, чтобы проверить, какие файлы его в настоящее время обработки (только убедитесь, что такой же пользователь, как тот, который начал работу Rsync) с

screen -x

с screen: добавить запись в ваше задание rsync:

rsync --log-file=/tmp/rsync-status.txt  src dst

затем выполнить журнал в режиме реального времени с помощью:

 tail -f /tmp/rsync-status.txt
9
задан 29 July 2010 в 00:50

5835 ответов

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторить попытку, пока он не попытается выполнить 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и это то, как я запускаю он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:24

судя по всему это известная ошибка в сопереживание, поэтому я решил запустить сочувствия от скрипта, который проверяет, является ли сеть (подключение к http://www.google.com интернет, правда сердцебиение :) если сеть не работает, он будет спать в течение 5 секунд и повторите, пока не попробовал 30 раз

это сценарий (имени waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

и это, как я запустить его из "меню запуска приложений":

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:24

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:24

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:25

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:25

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:25

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:26

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:26

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторить попытку, пока он не попытается выполнить 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и это то, как я запускаю он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:26

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторить попытку, пока он не попытается выполнить 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и это то, как я запускаю он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:27

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:27

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:27

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:27

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:28

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:28

судя по всему это известная ошибка в сопереживание, поэтому я решил запустить сочувствия от скрипта, который проверяет, является ли сеть (подключение к http://www.google.com интернет, правда сердцебиение :) если сеть не работает, он будет спать в течение 5 секунд и повторите, пока не попробовал 30 раз

это сценарий (имени waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

и это, как я запустить его из "меню запуска приложений":

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:28

судя по всему это известная ошибка в сопереживание, поэтому я решил запустить сочувствия от скрипта, который проверяет, является ли сеть (подключение к http://www.google.com интернет, правда сердцебиение :) если сеть не работает, он будет спать в течение 5 секунд и повторите, пока не попробовал 30 раз

это сценарий (имени waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

и это, как я запустить его из "меню запуска приложений":

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:29

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:29

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:29

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:30

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:30

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:30

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:30

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:31

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:31

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторить попытку, пока он не попытается выполнить 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и это то, как я запускаю он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:31

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:32

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторить попытку, пока он не попытается выполнить 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и это то, как я запускаю он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:32

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторить попытку, пока он не попытается выполнить 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и это то, как я запускаю он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:32

По-видимому, это известная ошибка в Empathy, поэтому я решил запустить Empathy из сценария, который проверяет, работает ли сеть (подключение к http://www.google.com, истинное сердцебиение Интернета :) Если сеть не работает, он будет спать в течение 5 секунд и повторит попытку, пока он не попытается 30 раз

Это сценарий (named waitfornet.py)

#!/usr/bin/python from urllib2 import urlopen, URLError from subprocess import Popen from time import sleep from sys import argv MAX_TRIES = 30 DELAY = 5 if len (argv) < 2: print ('Check for network connectivity and run a command once the net is up') print ('Tries up to %d times waiting %d seconds between each try' % (MAX_TRIES, DELAY)) print ('\nUSAGE: python waitfornet.py <command to run>') else: while True: MAX_TRIES -= 1 if MAX_TRIES < 0: raise ValueError ('Reached the max iteration count and the net is still down') try: data = urlopen('http://www.google.com') except URLError: # if there's a problem connecting to google, that must mean # that the net is still down, so sleep 5 seconds and try again print ('Internet is down... retrying...') sleep (DELAY) continue # if you got here it means that the urlopen succeded pid = Popen([argv[1], ' '.join(argv[1:])]).pid break

, и я так начал он из меню «Запуск приложений»:

~/scripts/waitfornet.py empathy
6
ответ дан 2 August 2018 в 05:33

Другие вопросы по тегам:

Похожие вопросы: