Browse Source

ocserv: use procd for init file

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Nikos Mavrogiannopoulos 9 years ago
parent
commit
0bfd280c2d
1 changed files with 6 additions and 22 deletions
  1. 6
    22
      net/ocserv/files/ocserv.init

+ 6
- 22
net/ocserv/files/ocserv.init View File

@@ -1,8 +1,7 @@
1 1
 #!/bin/sh /etc/rc.common
2 2
 
3
-SERVICE_USE_PID=1
4
-
5 3
 START=50
4
+USE_PROCD=1
6 5
 
7 6
 setup_config() {
8 7
 	config_get port         $1 port "4443"
@@ -96,7 +95,7 @@ setup_dns() {
96 95
 	echo "dns = $ip" >> /var/etc/ocserv.conf
97 96
 }
98 97
 
99
-start() {
98
+start_service() {
100 99
 	local hostname iface
101 100
 
102 101
 	hostname=`uci show ddns 2>/dev/null|grep domain|head -1|cut -d '=' -f 2`
@@ -162,23 +161,8 @@ start() {
162 161
 	chmod 600 /var/etc/ocpasswd
163 162
 	config_foreach setup_users ocservusers
164 163
 
165
-	service_start /usr/sbin/ocserv -c /var/etc/ocserv.conf
166
-}
167
-
168
-stop() {
169
-	service_stop /usr/sbin/ocserv
170
-}
171
-       
172
-reload() {
173
-	rm -f /var/etc/ocpasswd
174
-	touch /var/etc/ocpasswd
175
-	chmod 600 /var/etc/ocpasswd
176
-	config_foreach setup_users ocservusers
177
-
178
-	/usr/bin/occtl show status >/dev/null 2>&1
179
-	if test $? != 0;then
180
-		start
181
-	else
182
-		/usr/bin/occtl reload
183
-	fi
164
+	procd_open_instance
165
+	procd_set_param command /usr/sbin/ocserv -f -c /var/etc/ocserv.conf
166
+	procd_set_param respawn
167
+	procd_close_instance
184 168
 }