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

Rework crontab usage #2664

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/content_management/url_management/url_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ To enable automatic URL validation, set up cron to run the `ibexa:check-urls` co
For example, to check links every week, add the following script:

```
echo '0 0 * * 0 cd [path-to-ibexa]; php bin/console ibexa:check-urls --quiet --env=prod' > ezp_cron.txt
echo '0 0 * * 0 cd [path-to-ibexa]; php bin/console ibexa:check-urls --quiet --env=prod' > ibexa_cron.txt
```

Next, append the new cron to user's crontab without destroying existing crons.
Assuming that the web server user data is www-data:

```
crontab -u www-data -l|cat - ezp_cron.txt | crontab -u www-data -
crontab -u www-data -l | cat - ibexa_cron.txt | crontab -u www-data -
```

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


### Configuration
Expand Down
8 changes: 4 additions & 4 deletions docs/getting_started/install_ibexa_dxp.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,20 +402,20 @@ To enable delayed publishing of Content using the Date-based Publisher, you must

For example, to check for publishing every minute, add the following script:

`echo '* * * * * cd [path-to-ibexa-dxp]; php bin/console ibexa:cron:run --quiet --env=prod' > ezp_cron.txt`
`echo '* * * * * cd [path-to-ibexa-dxp]; php bin/console ibexa:cron:run --quiet --env=prod' > ibexa_cron.txt`

For 5-minute intervals:

`echo '*/5 * * * * cd [path-to-ibexa-dxp]; php bin/console ibexa:cron:run --quiet --env=prod' > ezp_cron.txt`
`echo '*/5 * * * * cd [path-to-ibexa-dxp]; php bin/console ibexa:cron:run --quiet --env=prod' > ibexa_cron.txt`

Next, append the new cron to user's crontab without destroying existing crons.
Assuming the web server user data is `www-data`:

`crontab -u www-data -l|cat - ezp_cron.txt | crontab -u www-data -`
`crontab -u www-data -l | cat - ibexa_cron.txt | crontab -u www-data -`

Finally, remove the temporary file:

`rm ezp_cron.txt`
`rm ibexa_cron.txt`

### Enable the Link manager

Expand Down