Forgot that part (#926)
[openwrt.git] / package / base-files / default / etc / rc.common
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 . $IPKG_INSTROOT/etc/functions.sh
5
6 START=50
7
8 start() {
9 return 0
10 }
11
12 stop() {
13 return 0
14 }
15
16 reload() {
17 return 1
18 }
19
20 restart() {
21 stop
22 start
23 }
24
25 boot() {
26 start
27 }
28
29 shutdown() {
30 return 0
31 }
32
33 disable() {
34 name="$(basename "${initscript}")"
35 rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
36 }
37
38 enable() {
39 name="$(basename "${initscript}")"
40 disable
41 ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
42 }
43
44 depends() {
45 return 0
46 }
47
48 help() {
49 cat <<EOF
50 Syntax: $initscript [command]
51
52 Available commands:
53 start Start the service
54 stop Stop the service
55 restart Restart the service
56 reload Reload configuration files (or restart if that fails)
57 enable Enable service autostart
58 disable Disable service autostart
59 $EXTRA_HELP
60 EOF
61 }
62
63 initscript="$1"
64 action="$2"
65
66 . "$initscript"
67
68 cmds=
69 for cmd in $EXTRA_COMMANDS; do
70 cmds="${cmds:+$cmds$N}$cmd) $cmd;;"
71 done
72 eval "case \"\$action\" in
73 start) start;;
74 stop) stop;;
75 reload) reload || restart;;
76 restart) restart;;
77 boot) boot;;
78 shutdown) shutdown;;
79 enable) enable;;
80 disable) disable;;
81 $cmds
82 *) help;;
83 esac"
This page took 0.050075 seconds and 5 git commands to generate.