Run a shell script after booting
Greetings!
I am creating a text-mode (init level 3) Knoppix system and I want to execute a shell script automatically when the CD boots.
What I have tried is an init script, but since the shell script doesn't ever exit, the inits never finish. :cry:
I have added the line to the /root/.bash_profile but it doesn't seem to get executed. :?
I have put the line (and the script itself for that matter) in /etc/profile but that didn't work either. :(
What I need is a remote linux server that ANYone can run. Even people who still look for the any key. The next piece I need to conquer is getting the shell script to automatically run in tty1 without any user intervention.
Anyone done this yet?
The script I am trying to execute is pretty simple:
Code:
#!/bin/sh
/usr/local/sbin/info_screen
And that's it!
Any help would be appreciated.
Thanx!
-Michael
Re: Run a shell script after booting
Quote:
Originally Posted by mpweber77
I am creating a text-mode (init level 3) Knoppix system and I want to execute a shell script automatically when the CD boots. What I have tried is an init script, but since the shell script doesn't ever exit, the inits never finish.
Have you tried adding your script to /etc/inittab? For example, to have "/usr/bin/top" running on virtual console 1 in runlevel 3, remove this single line from /etc/inittab:
Code:
1:12345:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
and replace it with these two:
Code:
1:1245:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
1a:3:respawn:/usr/bin/top >/dev/tty1 2>&1 </dev/tty1
Replace your script for "/usr/bin/top" and it should work.
Let us know how things go.
Regards,
- Robert
http://www.cwelug.org/