You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
recipients | null | No | Comma-separated string of email addresses
47
-
mailer | sendmail | No | Email method: sendmail or smtp or mail
48
-
smtpHost | null | No | SMTP host, if `mailer` is smtp
49
-
smtpPort | 25 | No | SMTP port, if `mailer` is smtp
50
-
smtpUsername | null | No | SMTP user, if `mailer` is smtp
51
-
smtpPassword | null | No | SMTP password, if `mailer` is smtp
52
-
smtpSecurity | null | No | SMTP security option (ssl|tls), if `mailer` is smtp
53
-
smtpSender | jobby@<hostname> | No | The sender and from addresses used in SMTP notices
54
-
smtpSenderName | Jobby | No | The name used in the from field for SMTP messages
55
-
runAs | null | No | Run as this user, if crontab user has `sudo` privileges
56
-
environment | null or `getenv('APPLICATION_ENV')` | No | Development environment for this job
57
-
runOnHost | `gethostname()` | No | Run jobs only on this hostname
58
-
maxRuntime | null | No | Maximum execution time for this job (in seconds)
59
-
output | /dev/null | No | Redirect `stdout` and `stderr` to this file
60
-
dateFormat | 'Y-m-d H:i:s' | No | Format for dates on `jobby` log messages
61
-
enabled | true | No | Run this job at scheduled times
62
-
haltDir | null | No | A job will not run if this directory contains a file bearing the job's name
63
-
debug | false | No | Send `jobby` internal messages to 'debug.log'
64
-
command | none | Yes | The job to run (either a shell command or anonymous PHP function)
65
-
schedule | none | Yes | Crontab schedule format (`man -s 5 crontab`) or Datetime format
66
-
</pre>
67
-
68
-
### Example `jobby.php` File ###
21
+
## Example ##
69
22
70
23
```php
71
24
<?php
72
25
73
-
require(__DIR__ . '/vendor/autoload.php');
26
+
require_once __DIR__ . '/vendor/autoload.php';
74
27
75
-
$jobby = new \Jobby\Jobby();
28
+
$jobby = new Jobby\Jobby();
76
29
77
30
// Every job has a name
78
-
$jobby->add('CommandExample', array(
79
-
// Commands are either shell commands or anonymous functions
80
-
'command' => 'ls',
31
+
$jobby->add('CommandExample', [
32
+
// Run a shell commands
33
+
'command' => 'ls',
81
34
82
35
// Ordinary crontab schedule format is supported.
83
36
// This schedule runs every hour.
84
-
// You could also insert Datetime string.
37
+
// You could also insert DateTime string in the format of Y-m-d H:i:s.
85
38
'schedule' => '0 * * * *',
86
39
87
40
// Stdout and stderr is sent to the specified file
88
-
'output' => 'logs/command.log',
41
+
'output' => 'logs/command.log',
89
42
90
43
// You can turn off a job by setting 'enabled' to false
91
-
'enabled' => true,
92
-
));
44
+
'enabled' => true,
45
+
]);
93
46
94
-
$jobby->add('ClosureExample', array(
95
-
// Commands can be PHP closures
96
-
'command' => function() {
47
+
$jobby->add('ClosureExample', [
48
+
// Invoke PHP closures
49
+
'closure' => function() {
97
50
echo "I'm a function!\n";
98
51
return true;
99
52
},
100
53
101
54
// This function will run every other hour
102
55
'schedule' => '0 */2 * * *',
103
56
104
-
'output' => 'logs/closure.log',
105
-
'enabled' => true,
106
-
));
57
+
'output' => 'logs/closure.log',
58
+
]);
107
59
108
60
$jobby->run();
109
61
```
110
62
111
-
### Paid Support
63
+
##Installation ##
112
64
113
-
[](http://supportedsource.org/consulting-services-and-support/jobby)
65
+
The recommended way to install Jobby is through [Composer](http://getcomposer.org):
66
+
```
67
+
$ composer require hellogerard/jobby
68
+
```
114
69
115
-
### Credits ###
70
+
Then add the following line to your (or whomever's) crontab:
0 commit comments