0c452ad273254fefea1598746d27ee526d07032d
[packages.git] / lang / php5 / files / php5-fastcgi.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2010-2011 OpenWrt.org
3
4 START=50
5
6 SERVICE_DAEMONIZE=1
7 SERVICE_WRITE_PID=1
8
9 start_instance() {
10         local section="$1"
11         local enabled
12         local port
13
14         config_get_bool enabled "$section" 'enabled' 0
15         config_get port "$section" 'port' 1026
16
17         [ $enabled -gt 0 ] || return 1
18
19         PHP_FCGI_CHILDREN='' \
20         service_start /usr/bin/php-fcgi -b $port
21 }
22
23 start() {
24         config_load 'php5-fastcgi'
25         config_foreach start_instance 'php5-fastcgi'
26 }
27
28 stop() {
29         service_stop /usr/bin/php-fcgi
30 }