Closed nirim000 closed 3 years ago
@sandain I'm working on this enhancement but I've ran into an issue:
My initial approach to tackle this problem was to spin off a child shell via nohup
at the end the start()
function that watches the server and restarts it if it detects that it crash. The problem is that only bash
allows you to export functions to child shells; sh
doesn't (and the shebang ontop of mscs is sh
). So, I would have to copy/paste of all the functions and dependencies of the start
command into the child shell code, which would make it quite lengthy and redundant. Any ideas on how to get around this? We could add a file that contains functions to reference so I wouldn't have to duplicate code, but then it wouldn't be a 1-file script.
Could the sub process just call mscs start
or whatever? Why do you need to export functions?
oh yes, your right that would work for start...im not sure why i didnt think of that. good catch. the only issue is that some of the functions i call don't have an associated command, but theres only a few of them. ill submit the PR soon so maybe you can get a better idea of what im talking about
I try to write a start script for spigot to restart through mscs in case of a crash, no matter what i do spigot is unable to start the script.
I'm currently relying on a cronjob to try to start the server in case of a crash.
Adding the ability to monitor crash and automatically restart after a crash to mscs would by most helpful.
I found a interactive script that seem like a good base https://gist.github.com/esolitos/af3e045552a87b513715e854d4a3fe16
sorry for my terrible formatting, i'm horribly tired.