Skip to content

Commit d456b1f

Browse files
authored
Merge pull request #59 from diego-vieira/patch-2
fix markdown styling
2 parents 95691db + db58cd3 commit d456b1f

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

demo/runners/README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ The runner will check the queue for new jobs and work the jobs. After working on
2626
1. Create a new PHP file named "SimpleRunner.php" (no naming convention here).
2727
2. Include the config file:
2828

29-
```php
29+
```php
3030
require_once '/path/to/your/config.php';
3131
```
3232

3333
3. Create a new Runner class (extending `PHPQueue\Runner`). The queue name can be defined in the `$queue_name` attribute.
3434

35-
```php
35+
```php
3636
class SampleRunner extends PHPQueue\Runner
3737
{
3838
public $queue_name = 'Sample';
@@ -41,14 +41,14 @@ class SampleRunner extends PHPQueue\Runner
4141

4242
4. Instantiate the class and call the `run()` method.
4343

44-
```php
44+
```php
4545
$runner = new SampleRunner();
4646
$runner->run();
4747
```
4848

4949
5. Run the Runner.
5050

51-
```
51+
```
5252
$ php SimpleRunner.php
5353
```
5454

@@ -92,8 +92,7 @@ $ php BeanstalkSampleStart.php
9292
$ php BeanstalkSampleStop.php
9393
```
9494

95-
***Note:***<br/>
96-
On CentOS, you will need to install `php-process` package: `sudo yum install php-process`
95+
*__Note:__ On CentOS, you will need to install `php-process` package: `sudo yum install php-process`*
9796

9897
### The Proper Way ###
9998

@@ -109,7 +108,7 @@ You can make your PHP-Queue runner start the same way.
109108

110109
1. Combine the start and stop scripts into 1 file. And use PHP's `$argv` ([reference](http://www.php.net/manual/en/reserved.variables.argv.php)) to switch between executing `start` or `stop`:
111110

112-
```php
111+
```php
113112
require_once '/path/to/your/config.php';
114113
$pid_file = '/path/to/process.pid';
115114
if (empty($argv[1]))
@@ -145,36 +144,36 @@ switch($argv[1])
145144
?>
146145
```
147146

148-
*__Note:__ Some `echo` statements were added to provide some on-screen feedback.*
147+
*__Note:__ Some `echo` statements were added to provide some on-screen feedback.*
149148

150149
2. Make your runner executable by adding this to the first line of the PHP script:
151150

152-
```
151+
```
153152
#!/usr/bin/php
154153
```
155154
and make the file executable under linux:
156155

157-
```
156+
```
158157
$ chmod a+x BeanstalkSampleDaemon.php
159158
```
160159

161160
That way, you can call the script directly without involving PHP:
162161

163-
```
162+
```
164163
$ ./BeanstalkSampleDaemon.php
165164
```
166165

167166
3. Move the file to `/etc/init.d/` folder.
168167

169-
```
168+
```
170169
$ mv BeanstalkSampleDaemon.php /etc/init.d/BeanstalkSampleDaemon
171170
```
172171

173172
*Notice that I moved it without the `.php` extension. You do not need the extension to be there as this file is now executable on its own.*
174173

175174
4. You can now run this script like a normal daemon:
176175

177-
```
176+
```
178177
$ /etc/init.d/BeanstalkSampleDaemon start
179178
```
180179

@@ -184,7 +183,7 @@ To make it into a service that starts on boot-up.
184183

185184
1. Add this to the top of your script:
186185

187-
```
186+
```
188187
# !/usr/bin/php
189188
<?php
190189
#
@@ -196,17 +195,17 @@ To make it into a service that starts on boot-up.
196195
...
197196
```
198197

199-
*__Note:__ Customize to your specific script.*
198+
*__Note:__ Customize to your specific script.*
200199

201200
2. Run this to add this to the boot up process:
202201

203-
```
202+
```
204203
$ chkconfig --levels 235 BeanstalkSampleDaemon on
205204
```
206205

207206
3. To delete it:
208207

209-
```
208+
```
210209
$ chkconfig --del BeanstalkSampleDaemon
211210
```
212211

0 commit comments

Comments
 (0)