1 MKSHELL=/opt/plan9/bin/rc
4 #test-start:VQPservice -u: foo-start
8 #test-stop:VQPservice -d: /
20 $P kexec -l /usr/src/linux/arch/x86/boot/bzImage --reuse-cmdline
23 # Initial setup/shutdown for mkinit
26 $P mount -o remount,rw /
27 # mount proc here to make bootchart happier
28 $P mount -t proc proc /proc
32 # Kill all process, then remount and sync
33 halt:QVE: utmp-stop hwclock-stop alsa-stop
34 echo TERMinating all processes
35 $P pkill -15 --inverse -g0 >/dev/null >[2=1]
37 { $P pgrep -vg0 && $P sleep 1 }
38 echo KILLing all processes
39 $P pkill -9 --inverse -g0 >/dev/null >[2=1]
41 { $P pgrep -vg0 && $P sleep 1 }
43 echo Remounting read-only
44 $P mount -o remount,ro /
49 # Listener for /dev/initctl, for shutdown(8)
50 initctl-start:VPservice -u: boot
54 { exec $P initctld $fifo |
56 $P mkinit $line >/dev/console >[2=1]
59 initctl-stop_cmd=fuser -k /dev/initctl
62 mounts-start:VPservice -u: boot
63 $P mdadm -A /dev/md4 /dev/sd[abc]4
67 # Mount devtmpfs and shm/pts subfolders
68 devtmpfs-start:VEPservice -u: boot
74 # Start mdev as initial/daemon
75 mdev-start:VEPservice -u: mounts-start
76 $P echo /sbin/mdev > /proc/sys/kernel/hotplug
80 # Start udev and trigger events
81 udev-start:VEPservice -u: mounts-start
84 $P udevadm settle '--timeout=10'
86 udev-stop_cmd=pkill udevd
89 modules-start:VEPservice -u: boot
94 # Clean out /tmp and /var/run directories
95 fsclean-start:VPservice -u: boot
98 $P mv $dirs /.old || true
101 $P install -m 1777 -d /var/run/screen # Fuck you Screen
102 $P exec rm -rf /.old &
105 # Spawn gettys for tty[23456]
106 getty-start:VEPservice -u: hostname-start utmp-start
107 $P respawn setsid agetty 38400 tty2 linux
108 $P respawn setsid agetty 38400 tty3 linux
109 $P respawn setsid agetty 38400 tty4 linux
110 $P respawn setsid agetty 38400 tty5 linux
111 $P respawn setsid agetty 38400 tty6 linux
113 getty-stop_cmd=fuser -k /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6
115 # Spawn qingys for tty[7]
116 qingy-start:VEPservice -u: hostname-start utmp-start modules-start
117 $P respawn setsid /sbin/qingy-DirectFB tty7 &
120 qingy-stop_cmd=fuser -k /dev/tty7
123 utmp-start:VPservice -u: fsclean-start
124 for (i in /var/run/utmp /var/log/wtmp) {
125 $P eval 'echo -n > $i'
130 utmp-stop_cmd=halt -w
133 cpufreq-start:VPservice -u: mounts-start
134 $P cpufreq-set -g ondemand
138 localhost-start_cmd=ifconfig lo 127.0.0.1
139 localhost-stop_cmd=ifconfig lo down
142 hostname-start_cmd=hostname
145 sysctl-start:VPservice -u: mounts-start
147 $P chmod a+w /sys/class/leds/smc::kbd_backlight/brightness
148 $P chmod a+w /sys/class/backlight/gmux_backlight/brightness
155 at-stop_cmd=pkill atd
157 cron-start:VPservice -u: localhost-start fsclean-start
160 cron-stop_cmd=pkill cron
162 hddtemp-start_cmd=hddtemp -d
163 hddtemp-stop_cmd=pkill hddtemp
165 hwclock-start_cmd=hwclock --hctosys --utc
166 hwclock-stop_cmd=hwclock --systohc --utc
168 mdadm-start_cmd=mdadm --monitor --scan --daemonize
169 mdadm-stop_cmd=pkill mdadm
171 smartd-start_cmd=smartd
172 smartd-stop_cmd=pkill smartd
174 sshd-start_cmd=/usr/sbin/sshd
175 sshd-stop_cmd=pkill sshd
177 swap-start_cmd=swapon -a
178 swap-stop_cmd=swapoff -a
180 syslog-start:VPservice -u: mounts-start
183 syslog-stop_cmd=pkill syslog
188 alsa-start_cmd=alsactl restore
189 alsa-stop_cmd=alsactl store
192 cups-stop_cmd=pkill cupsd
194 dbus-start:VPservice -u: fsclean-start localhost-start
195 $P install -m 1777 -d /var/run/dbus
196 $P /usr/bin/dbus-daemon --system
198 dbus-stop_cmd=pkill dbus-daemon
200 gpm-start_cmd=gpm -m /dev/input/mice -t ps2
201 gpm-stop_cmd=pkill gpm
203 gpsd-start_cmd=gpsd tcp://localhost:2222
204 gpsd-stop_cmd=pkill gpsd
206 keymap-start_cmd=loadkeys -u us-cc
208 polipo-start:VPservice -u: localhost-start
211 polipo-stop_cmd=pkill polipo
216 apache2-start:VPservice -u: fsclean-start
217 $P install -o apache -g apache -d /var/run/session
218 $P apache2 $(apache2-opts)
220 apache2-stop_cmd=pkill apache2
222 #bitlbee-start_cmd=sudo -u bitlbee bitlbeed /usr/sbin/bitlbee
223 bitlbee-start_cmd=bitlbee -D -u bitlbee
224 bitlbee-stop_cmd=pkill bitlbee
227 cups-stop_cmd=pkill cupsd
229 denyhosts-start_cmd=denyhosts.py --daemon
230 denyhosts-stop_cmd=pkill denyhosts.py
232 courier-start:VPservice -u: fsclean-start
233 $P install -o mail -g mail -d /var/run/courier
236 $P courierfilter start
237 $P courier-imapd-ssl start
239 courier-stop_cmd=pkill '(courier|authdaemon)'
241 dioc-start:VPservice -u: munged-start
243 $P mount -n /mnt/c/mnt/x
245 dioc-stop:EVPservice -d:
246 $P umount /mnt/c/mnt/x
250 diod-start:VPservice -u: munged-start
253 diod-stop_cmd=pkill diod
255 dovecot-start_cmd=dovecot
256 dovecot-stop_cmd=pkill dovecot
258 eth0-start_cmd=dhcpcd eth0
259 eth0-stop_cmd=dhcpcd eth0 -k
261 exim-start_cmd=exim -bd -q5m
262 exim-stop_cmd=pkill exim
264 gitd-start:VPservice -u: boot
265 $P exec /usr/libexec/git-core/git-daemon \
269 '--interpolated-path=/etc/git/%H%D' \
274 gitd-stop_cmd=pkill git-daemon
276 jabberd-start_cmd=sudo -u jabber -g jabber jabberd -b
277 jabberd-stop_cmd=pkill --uid jabber
279 mailman-start_cmd=sudo -u mailman -g mailman \
280 /usr/lib64/mailman/bin/mailmanctl -s start
281 mailman-stop_cmd=sudo -u mailman -g mailman \
282 /usr/lib64/mailman/bin/mailmanctl stop
284 munged-start:VPservice -u: localhost-start mounts-start
285 $P install -o munge -g munge -d /var/run/munge
286 $P sudo -u munge -g munge munged
288 munged-stop_cmd=pkill munged
290 mysql-start:VPservice -u: fsclean-start
291 $P install -o mysql -g mysql -d /var/run/mysqld
294 mysql-stop_cmd=pkill mysqld
297 ntpd-stop_cmd=pkill ntpd
299 privoxy-start_cmd=privoxy --user privoxy.privoxy /etc/privoxy/config
300 privoxy-stop_cmd=pkill privoxy
302 rngd-start_cmd=rngd -b -s64 -t60
303 rngd-stop_cmd=pkill rngd
305 spamd-start_cmd=spamd -u spamd -d
306 spamd-stop_cmd=pkill spamd
308 tftpd-start_cmd=in.tftpd -s -l /img/boot
311 tor-start:VPservice -u: boot
314 tor-stop_cmd=pkill tor
316 wlan0-start:VPservice -u: wpa-start
319 wlan0-stop_cmd=dhcpcd wlan0 -k
321 wpa-start:VPservice -u: mdev-start
323 $P exec wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
325 wpa-stop_cmd=pkill wpa
329 %-start:QVPservice -u: boot
330 if (~ $#($stem^-start_cmd) 0)
331 echo No such service $stem && exit 0
332 $P $($stem^-start_cmd) $($stem^-opts)
335 %-stop:QVPservice -d: /
336 if (~ $#($stem^-stop_cmd) 0)
337 echo No such service $stem
339 $P $($stem^-stop_cmd)
342 %-zap:QVPservice -d: /