Job
Job Class. This supersedes using crontab directly and provides a centralized interface for executing cron like commands.
FreePBX::Job()->getAll(); |
If you use this to add Jobs with the correct module rawname as the first parameter during uninstallation of the module the jobs will be uninstalled, additionally enabling and/or disabling a module will enable or disable it's associated jobs
- 1 Console Commands
- 2 Function Calls
- 2.1 getAll()
- 2.2 getAllEnabled()
- 2.3 addCommand()
- 2.4 addClass()
- 2.5 remove()
- 2.6 removeAllByModule()
- 2.7 setEnabled()
- 2.8 setEnabledByModule()
- 2.9 updateSchedule()
Console Commands
[root@Andrew14 pagingpro]# fwconsole job
Usage:
job [options]
Arguments:
command The command to execute
Options:
--enable=ENABLE Enable a specific job
--disable=DISABLE Disable a specific job
--run[=RUN] Run all jobs, or optionally run a single job if job id is appended
--list List known jobs
--force Force run even if disabled or not the right time
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Centralized job management |
List
List all jobs
[root@Andrew14 pagingpro]# fwconsole job --list
+------+----------------+-----------+--------------+---------------------+---------+
| ID | Module | Job | Cron | Next Run | Enabled |
+------+----------------+-----------+--------------+---------------------+---------+
| 7 | calendar | sync | * * * * * | 2019-05-14 10:51:00 | Yes |
| 10 | timeconditions | schedtc | * * * * * | 2019-05-14 10:51:00 | Yes |
| 17 | dashboard | scheduler | * * * * * | 2019-05-14 10:51:00 | Yes |
| 19 | userman | syncall | */15 * * * * | 2019-05-14 11:00:00 | Yes |
| 8562 | pagingpro | scheduler | * * * * * | 2019-05-14 10:51:00 | Yes |
+------+----------------+-----------+--------------+---------------------+---------+ |
Enable
Enable a specific job
Disable
Disable a specific job
Run
Run a specific job
or run all jobs
Force
Force run even if disabled or not the right time
Function Calls
getAll()
Get All Jobs
getAllEnabled()
Get all enabled jobs
addCommand()
Add/Update Job CLI Command
addClass()
Add/Update a Job Class
remove()
Remove a job by modulename and jobname
removeAllByModule()
Remove all jobs by module rawname
setEnabled()
Toggle Enabled on a job
setEnabledByModule()
Set Enabled by Module Rawname
updateSchedule()
Update the schedule of a job that already exists