My 1cent advice: do not insert a delay before your script, instead catch the pyownet.protocol.ConnError exception and retry if the alias file is dynamic (otherwise why copy it at every reboot?) you can also define/redefine aliases using owshell/ownet.
Please check this gist for an example of both techniques in python https://gist.github.com/miccoli/d16fcc01daff034d406832dca4decae3 <https://gist.github.com/miccoli/d16fcc01daff034d406832dca4decae3> After running this example all sensors on the localhost will be aliased to sens0, sens1, … Ciao Stefano For the benefit of the list, here is also the present gist content. import sys import time import pyownet.protocol TIMEOUT = 10 def main(): timeout_time = time.time() + TIMEOUT while time.time() < timeout_time: try: owp = pyownet.protocol.proxy() except pyownet.protocol.ConnError: time.sleep(1) else: break else: # Error! creation of owp has timed out sys.exit('Unable to open connection to owserver') # Success! we have a connection to owserver assert owp.present('/') for i, sens in enumerate(owp.dir()): owp.write(sens+'alias', 'sens%d' % i) for j in range(i): assert owp.present('sens%d' % j) if __name__ == '__main__': main() > On 03 Sep 2016, at 10:09, Mick Sulley <m...@sulley.info> wrote: > > My code relies on aliases and so I wanted to copy the correct version of > owfs.conf to /etc/owfs.conf and I assumed that I would need to restart > after that for it to be read and the correct alias file used. > > The thing I don't understand is that it is not the restart that causes > the failure, it is the copy. I have tried it without the restart line > and it still fails. Does owserver continually read /etc/owfs.conf and > detect that it being written? > > Regards > Mick > > On 03/09/16 00:10, Jan Kandziora wrote: >> Am 02.09.2016 um 22:48 schrieb Mick Sulley: >>> If I have removed the restart it still fails, however if I introduce a >>> delay it works >>> >>> cp owfs.conf /etc/ >>> sleep 5 >>> ./control.py >> logfile >>> >>> Less than 5 seconds it fails, 5 or more it works >>> >> That is because owserver takes a while before it has it's socket listening. >> >> Why do you restart owserver at all? It's not neccessary. It's designed >> as a daemon to connect to the hardware at system boot and sit there and >> wait until other programs connects to it. >> >> Kind regards >> >> Jan >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Owfs-developers mailing list >> Owfs-developers@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/owfs-developers > > > ------------------------------------------------------------------------------ > _______________________________________________ > Owfs-developers mailing list > Owfs-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/owfs-developers
------------------------------------------------------------------------------
_______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers