script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Restart server ??

Open kodifan opened this issue 1 year ago • 7 comments

Maybe a stupid question, but how in easy way restart server ? The best option would be restart option from server itself... Right now i have to run specific action in task scheduler in Synology ( script-server is running on Synology); pkill -f "python3 ./launcher.py" python3 ./launcher.py I tried to add such script in script-server but its not working (which is obvious , if you kill launcher, it wont trigger to run next instance) Is there any better trick, or im missing something?

kodifan avatar May 01 '23 12:05 kodifan

Services that restart themselves generally fork a controller process to:

  • Stop the original process
  • Start a new one

The other option is to put it under the control of your OS's native process manager (i.e., systemd in modern Linuxes)

In theory, something like this would simulate the first option from within script-server itself:

at now << xxEOFxx pkill -f "python3 ./launcher.py" python3 ./launcher.py xxEOFxx

This would put the actual control of the restart outside of the soon-to-be-dead script-server, but would depend on script-server's user having access to run commands via cron/at, and access to manage its own process.

MNeill73 avatar May 01 '23 13:05 MNeill73

unfortunately, there is no at command on synology box

kodifan avatar May 01 '23 15:05 kodifan

Hi @kodifan, I'm not aware of any ways to solve this problem, unfortunately.

bugy avatar May 02 '23 08:05 bugy

By the way, what are the reasons for the server restart?

bugy avatar May 02 '23 08:05 bugy

actually , its a script server itself. A lot of not yet implemented or not fully implemented options requires restart of server. And to be honest, most of apps that I use have such option avalible in UI

kodifan avatar May 02 '23 09:05 kodifan

ps. I just think about it, and it doesn't need to be physical restart of launcher.py, i think just full reload of all configs and scripts will be enough.

kodifan avatar May 02 '23 12:05 kodifan

Maybe a stupid question, but how in easy way restart server ? The best option would be restart option from server itself... Right now i have to run specific action in task scheduler in Synology ( script-server is running on Synology); pkill -f "python3 ./launcher.py" python3 ./launcher.py I tried to add such script in script-server but its not working (which is obvious , if you kill launcher, it wont trigger to run next instance) Is there any better trick, or im missing something?

You probably want something like having the process (re)started/managed by an process/service manager. Either you use systemd like mentioned by @MNeill73 in https://github.com/bugy/script-server/issues/666#issuecomment-1529699384 or use the container version of script-server which manages the process inside the container and then just restart the container.

treeol avatar Feb 15 '24 14:02 treeol