PDA

View Full Version : Autostart cmd-line prog on boot?



somebagel
01-18-2006, 03:51 PM
I am trying to turn my PC into a dedicated single-purpose controller for a project. Basically, I want to automatically start an interactive command-line program upon boot. Putting a line in /etc/inittab starts the program, but then the prompt shows up afterward. How can I autostart the program late enough in the boot process to "absorb" the prompt?

Details:
KNOPPIX 3.4 (recompiled, but still vanilla 2.4.26)
HD installed
Default runlevel 1 (necessary for quality-of-service reasons)

Dave_Bechtel
01-18-2006, 09:05 PM
Posting your inittab would help, but basically you should disable the "getty" line for whatever VT is displaying the program.

You should almost always have a getty on tty1 (or SOMEWHERE), but you might be able to start (and switch to) your interactive program on tty2:

inittab excerpt:


1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
##5:23:respawn:/sbin/getty 38400 tty5
##6:23:respawn:/sbin/getty 38400 tty6

# XXX 2005.1021 added
5:2345:respawn:/usr/bin/open -f -c 5 -w -- /usr/bin/nice /usr/bin/ethstatus -S3m
6:2345:respawn:/usr/bin/open -f -c 6 -w -- /usr/bin/watch -n 30 /bin/df -h
8:2345:respawn:/usr/bin/tail -f -n 30 /mnt/squid/access.log >>/dev/tty8
9:2345:respawn:/usr/bin/open -f -c 9 -w -- /usr/bin/top -s -d 10


As an example, you could do something like this:


2:1:respawn:/usr/bin/open -f -c 2 -s -w /yourproghere


--See ' man open ' for details.


I am trying to turn my PC into a dedicated single-purpose controller for a project. Basically, I want to automatically start an interactive command-line program upon boot. Putting a line in /etc/inittab starts the program, but then the prompt shows up afterward. How can I autostart the program late enough in the boot process to "absorb" the prompt?

Details:
KNOPPIX 3.4 (recompiled, but still vanilla 2.4.26)
HD installed
Default runlevel 1 (necessary for quality-of-service reasons)