Skip to content
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

@reboot #63

Open
hongkongkiwi opened this issue Jan 29, 2019 · 10 comments
Open

@reboot #63

hongkongkiwi opened this issue Jan 29, 2019 · 10 comments

Comments

@hongkongkiwi
Copy link

Does ofelia support @reboot command?

@BartoszBartniczak
Copy link

I don't think so 😞 Have you found any solution for this?

@hongkongkiwi
Copy link
Author

hongkongkiwi commented Mar 22, 2019

No solution for this.

I currently use supercronic to run jobs inside my docker. It's very lightweight and simple, but alas, that too does not support @reboot command.

To get around this, I actually run a shell script, which first runs the command, then runs supercronic. Messy but workable.

@BartoszBartniczak
Copy link

Supercronic looks good, but I need to have a separate container with cron jobs. I see, that supercronic does not support that feature.

So far, I added entrypoint.sh file with startup jobs, to one of my containers. It replaces @reboot pretty good.

@hongkongkiwi
Copy link
Author

I don't understand what you mean. I use supercronic to run other docker containers.

  • Master Cron Container (sueprcronic) based on library/docker - with mounted crontab & docker sock file from host
  • Sub docker containers are started by my cron job (just a normal docker run command)

@reboot is better because it handles failures in a more streamlined way, using the entrypoint is less ideal because you need to somehow handle failure, plus the logging is a different format. Other than that it is acceptable.

@BartoszBartniczak
Copy link

OK, maybe I did a mistake. I did not know that I can use docker.sock to run command on the other container. Do you have any example of using this? I think I understand this, but working example would be great.

Yeah, I know that running cron jobs in entrypoint is not the best idea, but lucky me, all my cron jobs are logged in database either. So far, I can use it this way.

@taraspos
Copy link
Collaborator

taraspos commented Feb 28, 2020

@hongkongkiwi, I'm not sure that I understand the question.
What is

@reboot command

exactly? Like to actually reboot docker host? 🤔

@hongkongkiwi
Copy link
Author

hongkongkiwi commented Feb 29, 2020

No, @reboot runs when the crond service is started upon boot.

If you take the following, it would look like this:
@reboot do-something-cool
@hourly do-something-cool

So, the reboot command is immediately run when the daemon is started, the reason it's called reboot is in a normal linux system, this happens once upon boot, in our docker obviously it would be each time the docker is restarted. These are conventions for modern cron daemons, the @hourly is just a nice helper since it can be also done with something like * 0 * * , but reboot is a special flag.

Take syncing files, you will want it to happen immediately to get things up to date, then you will want it at a regular interval after that.

@taraspos
Copy link
Collaborator

Got it, thanks!

@taraspos
Copy link
Collaborator

taraspos commented Mar 9, 2020

related #79

@jtbry
Copy link

jtbry commented Jul 8, 2022

For anyone still reading this, this issue is solved in PR #184. You can use the fork for now if you need the functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants