I deployed a Python-based Telegram anti-spam bot on the CodeAnywhere platform, but it keeps shutting down every two hours. I am curious if there is a command or script that can automatically restart the bot when it stops functioning. I’ve looked into various options but haven’t found a reliable solution. Could someone please provide advice or examples on how to ensure the bot runs continuously? Any step-by-step instructions or alternative methods to maintain bot uptime would be much appreciated.
hey, try a systemd service with Restart=always settings to auto kick off your bot when it stops. i also set up a quick bash loop as a watchdog on codeanywhere that worked well for me. hope that helps!
I have found that using a process manager like Supervisor can be a robust solution to ensure the bot keeps running. After setting it up on a similar platform, the configuration allowed for automatic restarts when the bot unexpectedly failed. I configured Supervisor to monitor the process continuously, and including a log rotation script helped in keeping the environment clean. This method requires some initial configuration but ultimately offered a stable solution compared to custom looping scripts, making it easier to manage long-term uptime issues.