If I run a program via rc.local I get no access to the keyboard or monitor with stdin and stdout. How can I get around this?
You could broadcast messages on all user's terminal with
wall: that's similar to how
shutdown warns all users the system is about to be shut down.
For user input, create a named pipe (e.g.
/var/rc_term), give write permissions to everyone and read commands from there. If you need to grab keys which are not specifically sent to the script, see if you can monitor files in
You should use & ampersand for commands in /etc/rc.local, which are not able to daemonize via other flags or not able to be finished in polynomial time...
#!/bin/bash /usr/bin/qemu-system-x86_64 -hda /opt/ubuntu_11_10.img -net nic -net tap,ifname=tap0,script=no,downscript=no & /usr/bin/qemu-system-x86_64 -boot d -m 10000 --enable-kvm -cdrom /opt/redhat.iso & /bin/bash /opt/boot_stage_background_mega_script.sh & exit 0
The & ampersand - used to fork process and avoid locking on launched command, so rc.local able to exit, and leave other boot sections finishing its job...