software that knows how to update itself

Brad Tilley bradtilley at usa.net
Wed Sep 15 08:46:34 EDT 2004


I've written and tested a *very basic* socket server that I'll have to 
deploy soon... sooner than I'd like as much of the functionality that I 
want to include hasn't been implemented or even tested yet. So, I've 
been thinking about writing a function that has the ability to upgrade 
the socket server remotely. However, I have never done anything like 
this so I'm looking for tips and advice on the subject.

The socket server runs continuously listening for connections so I'll 
always be able to communicate with it. Here's some pseudo code that 
captures the essence of what I'd like to do:

def update_urself():
       receive updated socket server code & write it to a file
       verify file with crc or md5sum check on both ends
       if verify is OK:
          close all connections
          replace sock_serv.py with sock_serv_update.py

if conn.recv == 'UPDATE'
    update_urself()

Does this look sane?







More information about the Python-list mailing list