source: freewrt/package/p910nd/files/p910nd.init@ 583d755

freewrt_1_0 freewrt_2_0
Last change on this file since 583d755 was 583d755, checked in by Thorsten Glaser <tg@…>, 19 years ago
  • change the SYSV init system to add a target "autostart"
  • on system startup, call autostart instead of start
  • on autostart, check /etc/rc.conf for whether the service is enabled and act appropriately; fall through into start target
  • move some pre-startup checks into the start target
  • some whitespace cleanup, when it makes much sense (XXX when I get the person who wrote these scripts...)
  • optimise dropbear a little

ok and approved wbx@

git-svn-id: svn://www.freewrt.org/trunk/freewrt@191 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 620 bytes
Line 
1#!/bin/sh
2
3DEFAULT=/etc/default/p910nd
4RUN_D=/var/run
5
6_start() {
7 mkdir -p $RUN_D
8 [ -f $DEFAULT ] && (
9 while read port options; do
10 case "$port" in
11 ""|\#*)
12 continue;
13 esac
14 p910nd $options $port
15 if [ $? -ne 0 ]; then
16 exit 1
17 fi
18 done
19 ) < $DEFAULT
20 exit 0
21}
22
23_stop() {
24 [ -f $DEFAULT ] && (
25 while read port options; do
26 case "$port" in
27 ""|\#*)
28 continue;
29 esac
30 PID_F=$RUN_D/p910${port}d.pid
31 [ -f $PID_F ] && kill $(cat $PID_F)
32 done
33 ) < $DEFAULT
34}
35
36case $1 in
37autostart|start)
38 _start
39 ;;
40 stop)
41 _stop
42 ;;
43 *)
44 echo "usage: $0 (start|stop)"
45 exit 1
46esac
47exit $?
Note: See TracBrowser for help on using the repository browser.