Skip to content

Commit c70626a

Browse files
committed
starter content for scheduled tasks
1 parent 31eea41 commit c70626a

File tree

6 files changed

+94
-20
lines changed

6 files changed

+94
-20
lines changed

admin-guide/en/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [Deployment](./deploy)
99
* [Configuration](./deploy#configuration)
1010
* [Email](./deploy-email)
11+
* [Scheduled Tasks](./deploy-scheduled-tasks)
1112
* [Jobs](./deploy-jobs)
1213
* [Users](./deploy-users)
1314
* [Multi-tenant](./deploy-multi-tenant)

admin-guide/en/deploy-email.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ If you run your own email server, you can ask for help in our [community forum](
108108

109109
---
110110

111-
Next, learn about how to improve performance with the [job runner](./deploy-jobs).
111+
Next, learn how to manage your [scheduled tasks](./deploy-scheduled-tasks).

admin-guide/en/deploy-jobs.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,24 @@ stdout_logfile=<log-file>
5858

5959
Replace the following variables in the configuration above with the correct paths in your system:
6060

61-
| Variable | Description |
62-
| --- | --- |
63-
| `<path-to-php>` | Absolute path on the server to the CLI PHP executable. This can be found on most Linux servers by running `which php`. |
64-
| `<root>` | Absolute path to the root directory of the application (OJS, OMP, OPS). |
65-
| `<log-file>` | Absolute path to a log file. If hosting in a cloud environment, you may want to [direct logs to stdout](https://stackoverflow.com/a/26897648/1723499). |
61+
| Variable | Description |
62+
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
63+
| `<path-to-php>` | Absolute path on the server to the CLI PHP executable. This can be found on most Linux servers by running `which php`. |
64+
| `<root>` | Absolute path to the root directory of the application (OJS, OMP, OPS). |
65+
| `<log-file>` | Absolute path to a log file. If hosting in a cloud environment, you may want to [direct logs to stdout](https://stackoverflow.com/a/26897648/1723499). |
6666

6767
> Take note that workers are long-running processes that load the application in memory. As a result, any changes when workers are running will not reflect instantly without restarting the worker.
6868
{:.notice}
6969

70-
Restart Worker.
70+
To restart the worker:
7171

7272
```
7373
php lib/pkp/tools/jobs.php restart
7474
```
7575

7676
The above command will quit the workers gracefully what is workers will get to complete the current job execution and then quit. Then the Supervisor will restart the workers.
7777

78-
Restart Supervisor.
78+
To restart Supervisor:
7979

8080
```
8181
sudo service supervisor restart
@@ -87,10 +87,10 @@ You may need to run the following command to apply the configuration changes.
8787
supervisorctl reread
8888
```
8989

90-
> **Warning:** We strongly recommend restarting the Worker rather than Supervisor to reflect and consider the new changes pushed to production. Restarting Supervisor suddenly will cause the workers to quit abruptly and if the workers are in the middle of processing a job, it will not get the chance to complete the job which may cause undesired.
90+
> **Warning:** We strongly recommend restarting the Worker rather than Supervisor to reflect and consider the new changes pushed to production. Restarting Supervisor suddenly will cause the workers to quit abruptly, and if the workers are in the middle of processing a job, they will not complete the job which may cause undesired effects.
9191
{:.warning}
9292

93-
To configure Supervisor on other systems, or to learn more about monitoring processes, read the [Supervisor documentation](http://supervisord.org/index.html).
93+
To configure Supervisor on other systems or to learn more about monitoring processes, read the [Supervisor documentation](http://supervisord.org/index.html).
9494

9595
Once you have set up the worker, turn the default job runner off in `config.inc.php`:
9696

@@ -110,7 +110,7 @@ php lib/pkp/tools/jobs.php run
110110

111111
A cron job configured to run the following command will process only one job.
112112

113-
```php
113+
```
114114
php lib/pkp/tools/jobs.php run --once
115115
```
116116

admin-guide/en/deploy-sandbox.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Beginning with OJS, OMP, and OPS 3.4.0-4, there is a sandbox mode that can be en
1919
To enable the sandbox mode for an installation, edit `config.inc.php` and find the `sandbox` setting in the `[general]` section. Setting it to `On` will have following impacts:
2020

2121
- The email `default` driver will be set to `log`. As a result, all emails will be routed to the server's error log and no emails will be delivered.
22-
- Scheduled tasks that run at regular intervals to send out reminder emails, deposit data with third-party services, and perform other tasks will be disabled. This will also disable schedule task execution via `Acron` plugin.
22+
- Scheduled tasks that run at regular intervals to send out reminder emails, deposit data with third-party services, and perform other tasks will be disabled.
2323
- Job execution will be disabled. However, jobs will continue to be dispatched to the queue as usual.
2424
- `Crossref` and `Datacite` deposits will be disabled.
2525
- The application will not have any interaction with the ORCID service.
@@ -46,22 +46,21 @@ default = log
4646

4747
Scheduled tasks are run at regular intervals to send out reminder emails, deposit data with third-party services, and perform other tasks. They may be triggered in a couple different ways, depending how you configured them.
4848

49-
If you have a **cron job** set up to run the following command, delete that cron job.
49+
To disable the built-in task runner, find and edit the following setting in the `[schedule]` section of `config.inc.php`.
5050

5151
```
52-
php tools/runScheduledTasks.php
52+
task_runner = Off
5353
```
5454

55-
If you have the **acron plugin** installed, remove it by running the following command in the root directory of the application.
55+
If you have a **cron job** set up to run the following command, delete that cron job.
5656

5757
```
58-
rm -rf plugins/generic/acron
59-
rm -rf lib/pkp/plugins/generic/acron
58+
php tools/runScheduledTasks.php
6059
```
6160

6261
### Disable jobs
6362

64-
Stop the job runner in order to prevent pending jobs like data deposits from being run. Turn the built-in job runner off in `config.inc.php`.
63+
Stop the job runner to prevent pending jobs like data deposits from being run. Turn the built-in job runner off in `config.inc.php`.
6564

6665
```
6766
job_runner = Off
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Scheduled Tasks - Advanced Configuration - Admin Guide - PKP Developer Docs
3+
description: Options to configure scheduled tasks with Open Journal Systems (OJS), Open Monograph Press (OPS) or Open Preprint Systems (OPS).
4+
book: admin-guide
5+
version: 3.5
6+
---
7+
8+
# Scheduled Tasks
9+
10+
Scheduled tasks are used to perform periodic tasks or [jobs](./deploy-jobs) on a schedule, such as [processing statistics](./statistics), removing expired data, sending emails, or exporting data to third-party services (e.g. registering DOIs or exporting articles to DOAJ).
11+
12+
To see available options, run:
13+
14+
```
15+
php lib/pkp/tools/scheduler.php usage
16+
```
17+
18+
To see all registered scheduled tasks, run:
19+
20+
```
21+
php lib/pkp/tools/scheduler.php list
22+
```
23+
24+
To run all pending scheduled tasks, run:
25+
26+
```
27+
php lib/pkp/tools/scheduler.php run
28+
```
29+
30+
To run a single specific scheduled task, which is particularly useful for development purposes, run:
31+
32+
```
33+
php lib/pkp/tools/scheduler.php test
34+
```
35+
36+
## Log Files
37+
38+
Scheduled task logs are located in files directory under `<files_dir>/scheduledTaskLogs`.
39+
40+
## Configuration
41+
42+
### Scheduled Task Runner
43+
44+
In 3.5 and later, the Acron plugin has been removed and a built-in task runner has been introduced.
45+
46+
To enable the built-in task runner, set the following in the `[schedule]` section in `config.inc.php`:
47+
48+
```
49+
task_runner = On
50+
```
51+
52+
To adjust the interval at which the built-in task runner runs, adjust the following setting in `config.inc.php`. A smaller value may negatively impact application performance.
53+
54+
```
55+
task_runner_interval = 60
56+
```
57+
58+
The built-in task runner may not be suitable for high-volume sites; in this case, we recommend using your operating system's task scheduler instead. The following is a sample crontab entry for *nix operating systems:
59+
60+
```
61+
* * * * * php lib/pkp/tools/scheduler.php run >> /dev/null 2>&1
62+
```
63+
64+
### Notifications
65+
66+
To receive an email notification only when a scheduled task fails, set the following in `config.inc.php`. Otherwise, all tasks will generate a notification.
67+
68+
```
69+
scheduled_tasks_report_error_only = On
70+
```
71+
72+
---
73+
74+
Next, learn about how to improve performance with the [job runner](./deploy-jobs).

admin-guide/en/deploy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ force_ssl = On
138138
The software must run some tasks every day, such as compiling usage statistics. You should set up a cron job to run the following command once a day.
139139

140140
```
141-
php tools/runScheduledTasks.php
141+
php lib/pkp/tools/scheduler.php run
142142
```
143143

144-
If you are unable to configure this cron job, you must enable the Acron plugin after you have installed the software.
144+
Learn more about [scheduled tasks](./deploy-scheduled-tasks).
145145

146146
## Job Runner
147147

0 commit comments

Comments
 (0)