Open klauweg opened 11 months ago
Hi @klauweg , unfortunately it's not :(
Can you edit the script to be a wrapper, and check for it's own "last run date" (via a touch file or similar mechanism)? Then, if it hasn't run since "x", run.
Then you could schedule that job to run frequently enough to catch a restart.
For that matter... Bugy, is there a place to look for "Scriptserver's last start time"? You could then compare the last script run to SS's last start, and run if SS restarted since the last run. And then schedule as above.
On Fri, Nov 3, 2023, 2:16 AM Iaroslav Shepilov @.***> wrote:
Hi @klauweg https://github.com/klauweg , unfortunately it's not :(
— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/712#issuecomment-1791936999, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3X6KUWCXAHHHUNJLPDYCSD2PAVCNFSM6AAAAAA633WYJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJRHEZTMOJZHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Or, leave the script itself alone, except for adding said touchfile, and then schedule a separate watchdog that does the SS-vs-script-last-run comparison, and runs the scripts behind itself if SS has restarted since last runs.
On Fri, Nov 3, 2023, 11:40 AM Mark Neill @.***> wrote:
Can you edit the script to be a wrapper, and check for it's own "last run date" (via a touch file or similar mechanism)? Then, if it hasn't run since "x", run.
Then you could schedule that job to run frequently enough to catch a restart.
For that matter... Bugy, is there a place to look for "Scriptserver's last start time"? You could then compare the last script run to SS's last start, and run if SS restarted since the last run. And then schedule as above.
On Fri, Nov 3, 2023, 2:16 AM Iaroslav Shepilov @.***> wrote:
Hi @klauweg https://github.com/klauweg , unfortunately it's not :(
— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/712#issuecomment-1791936999, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3X6KUWCXAHHHUNJLPDYCSD2PAVCNFSM6AAAAAA633WYJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJRHEZTMOJZHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@MNeill73 unfortunately there is no simple way to find out the last start time. The only way is to read server.log
That's a relatively trivial task, though...in bashlike form...
SSStartLog=grep "*some identifiable start string from the log*" /path/to/server.log | awk "{print *$the $fields $that $are $the $date*}"
SSStart=date --date="${SSStartLog}" %+"%s"
And now you have Scriptserver's start time in epoch format. Then...
TouchfileTime=stat -c %y */path/to/touchfile*
# File last
modification date in human-readable form
TouchfileLast= date --date="${TouchfileTime}" %+"%s"
And that's the touchfile's last modification in the same form. Compare the two, run if ${SSStart} > ${TouchfileLast}.
Message ID: @.***>
Hm, i thought about some tricks with the scheduling feature already. It would be easy if there where an option to prevent a script from running with multiple Instances. But it would be a bit poor anyway.
Maybe it could be feasible to create scheduling entries by a wrapper for script-server before starting it. Every configured script with enabled scheduling gets a one-shot entry let's say for one minute later. Afters starting script-server all prepared scripts will be started with a little delay.
Of course i would prefer to have a button on script-server webinterface to start them itself ;-).
Hello, The script works great, thank you very much. The idea of automatically launching a script at script-server startup is a fantastic one. In my organization, we have servers that shut down at night to manage energy consumption, and we need scripts to run when the server restarts. The problem is that I cannot schedule the time. Some servers start as soon as someone arrives first and badges in the morning at the building.
Is it possible to start scripts automatically after starting launcher.py?