Run a script everytime I get a new RSS item

1

1

I have a Steam based game server, Unturned for GNU-Linux. I have to update it manually running a /home/steam/update.sh script.

update.sh downloads the latest version of the game server and the service is restarted.


What I tried
I made a cronjob to run update.sh everyday at 9pm (they usually update at 7,8 or 9pm in that time). But it's not a nice solution because someday they would be updating at 9:15 and the server could be offline for a day.

0  21 * * * /home/steam/update.sh > /dev/null 2>&1

What I want
I figured out that particularly for this game, after every update they post a changelog and Steam provides a RSS link. http://steamcommunity.com/games/304930/rss/

Is there any way to run my update.sh every time they update the RSS?
Is there any way to check if the server is updated?

Thank you in advance.

Jose Serodio

Posted 2016-09-02T10:27:45.000

Reputation: 111

Did you write the update.sh yourself? Depending on it you could just include some logic to decide whenever files changed and restart only if they did? If you get an archive you could keep the the latest version and compare it against the latest download. – Seth – 2017-01-24T08:54:34.650

Answers

3

Well, I'd say there is. If you have a cron job running every say 30 minutes (or more often if you're that hooked on a swift response) that runs a script which only checks for new RSS entries. In case of a new entry it calls your update script and if not - does nothing. This won't slow your system down one bit - even if you check the RSS feed every minute. You will however have to write your own little thing to keep track of RSS entries, but I guess you only have to store the timestamp of your last known RSS entry.

NinjaTool

Posted 2016-09-02T10:27:45.000

Reputation: 31

Well now I know there is a way, but still I'm not sure how to achieve this. – Jose Serodio – 2017-01-24T15:26:29.030

0

short answer : No.

long answer :

  • you are pulling an rss feed, people at steamcommunity can't push you a "magic signal" that can trigger an update.

  • the crontab solution is fine, just put it a 9pm16 to be sure, update.sh must be able to handle a unresponsive server.

Archemar

Posted 2016-09-02T10:27:45.000

Reputation: 1 547

I don't know if you saw the RSS, but the guy who make the posts is the game developer of the actual game. He makes these posts after every update (changelog), It's not about 'magical signs'. I was thinking about a RSS reader for gnu-Linux command line in which you could detect new unread posts / updates, causing the trigger of my script. There has to be better ways, but this should be a way. – Jose Serodio – 2016-09-02T19:21:06.023

My service auto-starts if it crashes or something, so I don't have any problem with my update.sh, after all the update in the last line it just restarts the systemd based service. I still don't like my cron-job solution because if I set it to multiple hours, people will get the server restarted 2 times each day in only 2 hours (id est: 7pm - 9pm, hot gaming hours) and I don't think this is the best solution. The perfect solution should be the perfect sync and only one restart, maybe each week or whenever the update takes place, but not everyday because the server doesn't update everyday. – Jose Serodio – 2016-09-02T19:21:08.630