Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rework crontab usage #2664

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Rework crontab usage #2664

wants to merge 1 commit into from

Conversation

adriendupuis
Copy link
Contributor

Question Answer
JIRA Ticket
Versions
Edition
  • rebrand temporary file
  • format

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

Copy link

github-actions bot commented Mar 7, 2025

```

Finally, remove the temporary file:

```
rm ezp_cron.txt
rm ibexa_cron.txt
```
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The whole section could be rewrite. 2 suggestions:

  • With a temporary file containing the whole crontab:
For example, to check links every week, the cronjob line looks like the following
where `[path-to-ibexa]` should be replaced with actual path to the installation directory:

```
0 0 * * 0 cd [path-to-ibexa]; php bin/console ibexa:check-urls --quiet --env=prod
```

Append the new cronjob line to user's crontab without destroying existing cronjob lines.
Assuming that the web server user data is `www-data`, it can be added this way:

```bash
crontab -u www-data -l > ibexa_cron.txt # backup existing cronjob list
echo '0 0 * * 0 cd [path-to-ibexa]; php bin/console ibexa:check-urls --quiet --env=prod' >> ibexa_cron.txt # Add cronjob line
crontab -u www-data - ibexa_cron.txt # replace with new cronjob list
rm ibexa_cron.txt # remove temporary file
```
  • With a one liner
For example, to check links every week, the cronjob line looks like the following
where `[path-to-ibexa]` should be replaced with actual path to the installation directory:

```
0 0 * * 0 cd [path-to-ibexa]; php bin/console ibexa:check-urls --quiet --env=prod
```

Append the new cronjob line to user's crontab without destroying existing cronjob lines.
Assuming that the web server user data is `www-data`, it can be added this way:

```bash
(crontab -u www-data -l; echo '0 0 * * 0 cd [path-to-ibexa]; php bin/console ibexa:check-urls --quiet --env=prod') | crontab -u www-data -
```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Side note: recent_activity.md doesn't explain how to add its cron job line

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant