Open ara4n opened 7 years ago
One could use this line in a crontab to automatically restart the script when it crashed :
*/2 * * * * python -c "import os;S='systemctl ';M=' MastodonToTwitter';'Active: inactive' in os.popen(S+'status'+M).read() and os.system(S+'start'+M)"
This could be interesting in all those cases : #46 #43 #42 #14 #13 …
The correct way is simply to have Restart=always
in the service file
i should have mentioned that I now run it in an 'enterprise loop' in a screen session (while true; do ./MastodonToTwitter; sleep 5; done
or something), which has much the same effect. so far it hasn't broken and spammed the mastodon to death....
@remram44 Restart=always
is set by default (in the /etc/systemd/system/MastodonToTwitter.service
file) when installing MastodonToTwitter… yet it still needs an additional watchdog mechanism.
After a few(?) hours of no twitter activity, the script crashed out with
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.twitter.com', port=443): Max retries exceeded with url: /1.1/statuses/user_timeline.json?since_id=860322898879361024&tweet_mode=extended&exclude_replies=True&include_rts=False&trim_user=False (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd45fdee940>: Failed to establish a new connection: [Errno 110] Connection timed out',))
.