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

Example on how to set up Cron #57

Merged
merged 1 commit into from Feb 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -330,6 +330,21 @@ accessories:

Now run `mrsk accessory start mysql` to start the MySQL server on 1.1.1.3. See `mrsk accessory` for all the commands possible.

### Using Cron

You can use a specific container to run your Cron jobs:

```yaml
servers:
cron:
hosts:
- 192.168.0.1
cmd:
bash -c "cat config/crontab | crontab - && cron -f"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you running you cron container as root? Because there seems to be some massage required to make this command work as non-root user, I couldn't figure out..

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also struggling to make logs of cron jobs available to docker logs, I tried a couple of things (like this one for example) but none seems to work

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up running as root, you can check my write-up on this blog post

```

This assumes the Cron settings are stored in `config/crontab`.

### Using a generated .env file

If you're using a centralized secret store, like 1Password, you can create `.env.erb` as a template which looks up the secrets. Example of a .env.erb file:
Expand Down