-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @reboot command #30
Comments
What's your expectation for what (I'm a little concerned about this being potentially confusing, since that's not what you'd normally expect from a |
Yes that is right, I would expect supercronic to run the script when it first starts up. That means I can have both an hourly and a startup command all in the same cron file (which makes it pretty clear). Here is my use case.
So you can see my problem, there's no way in this configuration to run some arbitrary script after runit. How I would handle this on other systems might be to do something like @reboot in the crontab so that after the cron daemon starts up it will run this script once. The only other workaround for now is to have a service that runs once off scripts, but that's quite awkward. |
I'm looking for this feature as well. Maybe rather than With @krallin - Would you be open to a PR adding this feature? |
@cgons yes, with the minor caveat that I think |
Sounds like a great solution! Looking forward to the PR. |
Awesome, BTW, is this the correct place to talk about implementation details (ie what I plan to change/add etc...)? |
@cgons sure, that's fine 👍 |
Any progress on this @cgons ? I work around this by adding a docker-entrypoint.sh file, but I would love to get rid of this extra process handling and have everything done within supercronic. |
Sorry, I had to go an pat. leave for a few months and ended up having negative free time to work on this. I'm back now and I want to try and get this working over the next few days/weeks. I'll post here with an update. Be on my case though as that's a motivator to get this implemented! :) |
@krallin - I was thinking of creating a Inside I have to think a little more about how to keep track of when the job was run and where to store that state. I should probably take advantage of the Let me know what you think. |
I think you should instead create a separate interface that wraps the existing cron expression interface, because you're also going to need a I'm not clear on why you suggest |
Yep, that's what I'll have to do. I was trying to get away with making a minimal amount of changes but, as you pointed out, that won't really work. I'll get this working in a branch on my fork and then ping you. I can then make any changes you'd like to see. |
I'm not really fan of having a new (non-standard, The Vixie cron manual (which, AFAIK introduced this directive) just says "run once after reboot"; but the debian version of the manual page states: "Please note that startup, as far as |
Sorry, couldn't wait until someone started the implementation. I implemented the issue. Unfortunately this was my first contact with Golang. So please don't expect too much :-). Besides, it is somehow a hack ... But for my purposes it works. I have extended the translation table in Cronexpr: "@start", "*/1 * * * * * * *". https://github.com/dmaj/supercronic Sample: |
Maybe this is interesting for others as well. I solved the @reboot topic for me by simply doing a one off execution of my cron tasks before actually starting supercronic. This is easily doable since I am not mounting my crontab file into the container, but actually generate it at container startup. This has for me the added benefit that I am making sure that the cron jobs work at all (else the container would fail to start). |
i created a pull request to implement this issue. in the first run of the main loop i execute all jobs with the expression @start. after then the other periodic jobs will be scheduled. |
Awesome! Can we get this merged? |
would love to see this merged |
Actually I would prefer I would avoid using nonstandard name as |
Allow library to be used in parallel
was this ever implemented? Would be a really nice feature |
I would also like to know if there is a way to run a script only once. I do not exactly need a Currently I need to override the initial command in my |
I'm still crossing my fingers on this. It's been a year since the last update, any movement on this (whether it's |
Hi there,
I'm currently running supercronic in a docker and it's working great.
I would like to run my script on "boot" e.g. when supercronic is started, as well as at a set interval. Normally in many cron versions we can use the standard @reboot to run a script on reboot, but in my testing it looks like supercronic doesn't currently support this.
Would it be possible to add this functionality? I notice that other shortcuts such as @hourly are supported.
I do have a work-around which is to run a shell script /start-container which simply runs my script and then runs supercronic, but it seems a bit awkward!
The text was updated successfully, but these errors were encountered: