Python Script for managing a VM on digitalocean

Find multiplayer games.
Tools/scripts to run a dedicated server.
EndOfFile
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Apr 06, 2016 11:45 am
Contact:

Python Script for managing a VM on digitalocean

Post by EndOfFile »

Hi,

i am hosting my factorio headless server on a VM on digitalocean.
Since you pay there for the actual runtime ($0.015/h for the second smallest one) of your VM and can save up to 5 snapshots for free its really cheap ;)
And you can always make a bigger VM if you need more performance.

So i had to always had to create the VM, play, take snapshot, destroy VM manually...

Since that is boring as hell i made a script for that: https://github.com/EndOfFile/factorio_on_DO (Use with caution, deletes stuff)

Regards
EOF
Change log
Last edited by EndOfFile on Mon May 16, 2016 12:34 pm, edited 2 times in total.
User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: Python Script for managing a VM on digitalocean

Post by HanziQ »

Regarding the assumptions you have, you should at least ask before destroying anything, I didn't see anything like that in the code. Or actually select the VM to destroy by name, which should be somehow possible, not sure.
EndOfFile
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Apr 06, 2016 11:45 am
Contact:

Re: Python Script for managing a VM on digitalocean

Post by EndOfFile »

I don't want to ask for permission since i just want to run it and forget.

But i did now change it to only stop/snapshot/destroy the VM that matches the defined vm_name inside the script (Assuming that the set vm_name is unique for all VMs).
For cleaning up old snapshots now only those are considered that match the snapshot naming scheme. (Oldest one gets deleted if there are more than 2)
Post Reply

Return to “Multiplayer / Dedicated Server”