Crude Mass Update Python Script


Camaban

Recommended Posts

Basically, I've got about nine devices running Debian, Ubuntu and CentOS running on i386, x86_64 and ARM devices.

 

I've also got a properly configured ~/.ssh/config file.

 

I wrote the Python script included in the attached text file to automate the updates.

 

This requires a file called BTSync-list.txt located where the SERVERLIST variable is pointing that contains a list of servers to be managed.

 

It starts off by asking what the target version is (IE: 1.3.87)

Then checks whether this is a valid version by checking whether http://syncapp.bittorrent.com/1.3.87/ exists.

 

Then proceeds through SERVERLIST

First it checks the installed version of btsync to see if it matches the target version

 

If it doesn't, it checks for a processor type defined under PROCESSORLIST using the output of uname -a

 

Then it uses SCP to transfer the correct version that has already been placed in INSTALLERDIR/PROCESSOR/btsync

IE:  /home/pi/BTSync-Installers/x86_64/btsync to the target home directory on the target system.

 

Then checks that the correct version has been copied.

 

Then executes the correct version using: nice ~/btsync --config ~/sync.conf

nice was used because one of these devices is a Raspbian server. I couldn't be bothered having it not nice on other systems.

 

My Python is fairly primitive, so any suggestions or improvements are welcome. At the very least though, this appears to be functional. About the only thing I can think of (at 4am) that I've gotten lazy on was checking to confirm that the relevant btsync files exist under INSTALLERDIR.

 

Obviously rename the attached file to .py - for some weird reason this forum wouldn't allow me to post executable scripts as executable scripts ;-)

CheckBTSync.txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.