Operating System - Linux
1748000 Members
4969 Online
108757 Solutions
New Discussion юеВ

running dtach on tty1 automatically after reboot...

 
bong_3
Advisor

running dtach on tty1 automatically after reboot...

hi all...
just want to know whether i can run dtach on tty1 automatically? meaning after i reboot the machine, dtach is already running and immediately i can run the application into its main console.

also, after i exit. this dtach process always run...
3 REPLIES 3
Alexander Chuzhoy
Honored Contributor

Re: running dtach on tty1 automatically after reboot...

generally to execute command upon boot edit the file /etc/rc.local and add the commands there.
Jerome Henry
Honored Contributor

Re: running dtach on tty1 automatically after reboot...

Yes, go to /etc/rc.d/init.d, create a batch that says :
dtach -arguments you want >tty1
And at rc3.d or rc5.d, according on if you use text or graphical boot, add a line looking like
S93batchname, replacing batchname with the name you choose for your batch, and 93 by the highest number you see (if last number is 87, use 88, and so on).

hth

J
You can lean only on what resists you...
Dave Falloon
Trusted Contributor

Re: running dtach on tty1 automatically after reboot...

You may also be able to put dtach in the inittab as the program to run on the tty's? I don't know much about dtach as I have never used it before, but I have some experience changing program that logs users in. Check out your inittab for a line such as this:

1:2345:respawn:/sbin/getty 38400 tty1

you may want to change the program from /sbin/getty to something else, for example a shell script that prints "You can't login here". I did that to my brother when he left his root passwd sticky noted to the bottom of his keyboard :)

If dtach is able to replace getty you could call it directly as long as it behaves in a way that init expects. ie, it dies cleanly :) Here is how init works:

init scans you inittab, sees the line for tty1 and forks a child that just waits for the process to finish and if it found a respawn it will start the process again. You could start any program you want to really.

Just an idea :)

Dave
Clothes make the man, Naked people have little to no effect on society