nekohayo / specto

Automatically exported from code.google.com/p/specto
0 stars 0 forks source link

network check on startup #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is not a problem, rather an idea for enhancement.
I think because specto is an automation tool, it is important that it can
be run automatically.
I got tired of always having to start it manually and wrote a little script
start_specto, which is called when the seesion is started:

while True:
    try:
        # try if google can be reached, i.e. connection to internet is up
        f = urllib.urlopen('http://www.google.com/')
        f.close()
    except IOError:
        # if not, wait 20 seconds before trying again
        time.sleep(20)
    else:
        # if yes, start specto
        os.system('specto')
        break
This was necessary because, when I just put the command 'Specto' into the
startup programs for sessions, Specto would start before the connection to
the internet was up and the watches were not executed. I doubt it that this
is a general solution, but maybe there should be a setting that the user
can enable so that specto keeps trying when not connected to the internet.
Also, I must confess, I do not exit Specto orderly. The process is killed
when the system shuts down. Hope this does not have adverse effects and I
suppose there are better solutions too.
Or have I overlooked something terribly simple? 

Original issue reported on code.google.com by knut.ger...@alice-dsl.net on 17 Nov 2006 at 11:16

GoogleCodeExporter commented 9 years ago
Hmm... I thought specto was able to start even if the websites did not respond? 
It
would put errors everywhere but it would still start no?

Original comment by nekoh...@gmail.com on 17 Nov 2006 at 8:51

GoogleCodeExporter commented 9 years ago
I had some watches with refreshing-time 1 day. When Specto was started (and the
connection to the Internet wasn't up yet) it tried to compare and couldn't. It 
would
then not try again when the Internet was up. So the watch never gets checked if 
the
computer isn't up at the exact time when the watch was set. 

Original comment by knut.ger...@alice-dsl.net on 18 Nov 2006 at 10:51

GoogleCodeExporter commented 9 years ago
It makes sense... The only problem I see with the script is that it runs the 
version
of specto that is installed system-wide, not the one you use with launch.sh 
(unless
you adapt the script). But setup.py may be fixed soon so it could be used.

However, it seems to me this is a band-aid solution. I think it could make more 
sense
to instead add this check directly in the code. For example, on startup of 
Specto,
before doing "start_all_watches", we could try pinging google, and sleep if it
doesn't work. That way you would not need a special launcher script.

Original comment by nekoh...@gmail.com on 18 Nov 2006 at 1:16

GoogleCodeExporter commented 9 years ago
I added the feature in the SVN trunk, revision 7, could you try it out and see 
if it
suits you? You could use launch.sh on your session startup until setup.py is 
entirely
fixed.

Original comment by nekoh...@gmail.com on 18 Nov 2006 at 6:53

GoogleCodeExporter commented 9 years ago
Done. Works great (revision 9).

Original comment by knut.ger...@alice-dsl.net on 19 Nov 2006 at 7:26

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 1 Jul 2007 at 2:29

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 18 Mar 2008 at 1:53

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 18 Mar 2008 at 1:54