LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Headless, mouseless, keyboardloess SuSE box (https://www.linuxquestions.org/questions/linux-newbie-8/headless-mouseless-keyboardloess-suse-box-459630/)

kehtahui 06-29-2006 09:46 PM

Headless, mouseless, keyboardloess SuSE box
 
Hi all,

I've installed SuSE 9.3 on HP Compaq (Athlon 64 3500+). I want to make this box headless, mouseless and keyboardless. Once it's boot up properly, it's able to pop-up a window (xterm, etc) on another workstation (running Solaris/Windows OS) to indicate that the SuSE box is boot-up properly and in good health. And if turn off, it will close the pop-up window on the remote workstation.


Any guys here know any tools/scripts which is able to do this. Many thanks.

regards,

lennon:newbie:

frob23 06-29-2006 11:02 PM

The first thing you want to do is use init level 3 as your default. You don't want to run an Xserver.

Edit /etc/inittab and change
Code:

id:5:initdefault:
to
Code:

id:3:initdefault:
Now create a user (anyone is good... but it's easiest if you use the same username on the machine you want the window to appear on). Create the following file in their directory.

As that user run "ssh-keygen -t dsa" and use an empty passphrase. Then
Code:

cat ~/.ssh/id_dsa.pub | ssh username@hostname.of.display.machine "cat >> ~/.ssh/authorized_keys"
This will mean your headless machine user can log in without a password prompt. It's somewhat important to making this automatic. Consider the security implications of this because if someone gets into that account they can get into your machine.

As the user on the headless machine, create /home/{username}/window.sh and make it executable. Use the following, changed to suit your environment.
Code:

#!/bin/sh
# Use the hostname given in "xauth list" on the
# display machine.  Not localhost but something which can be
# reached from this machine.
remote=hostname.of.display     
SSHCMD="ssh username@$remote"

DISPLAY=${remote}:0 ; export DISPLAY
xauth add ${remote}:0 `${SSHCMD} xauth list | grep $remote | grep XDM | awk '{print $2 " " $3}'`
xterm &

Then you just set this program to run at boot (as your user). And you're set.

The window will close automatically when the machine goes through shutdown.

kehtahui 06-30-2006 12:51 AM

Hi Frob23,

Thank you for your clear instructions. I'm able to run the window.sh script now on init 5.

The problem is where to place this program to run at boot? I looked through and found it can be place in ~/.xinitrc file under my user directory:
Code:

/export/home/users/lennon/window.sh
exec startkde

As I'm still doing testing, I'm plugin my monitor, keyboard and mouse to this SuSE box, when boot up, nothing shown on remote workstation. But if login my user on this SuSE box than the xterm will pop up on the remote workstation. Anyway to pop up on remote workstation but without login in on my SuSE box?

The pop up window is not close when SuSE box is shutdown, it'll only close when the SuSE box is restarted. :confused:

frob23 06-30-2006 06:09 PM

Okay, don't put it in .xinitrc. And don't start KDE. You're not running a window manager on this machine, are you? You just want a terminal into it.

I realize that I didn't tell you how to set it up at boot and to properly shutdown.

Save the following as /etc/rc.d/statwindow
Code:

#!/bin/sh
#This is a script to control the remote terminal window
#program.

case $1 in
    start)
        su lennon -c /export/home/users/lennon/window.sh
        ;;
    stop)
        for pid in `ps aux | grep xterm | awk '{print $2}'`
        do
            kill $pid
        done
        ;;
    *)
        echo "Unknown command."
        ;;
esac

The do the following:
Code:

cd /etc/rc.d/rc3.d
chmod +x ../statwindow
ln ../statwindow S99statwindow
ln ../statwindow K22statwindow

This should take care of it for you. Note, linux distros are often slightly different in how they boot... but this should work. I also admit that I hesitated to offer advice on that specific part because I don't use linux daily and don't even have a spare system to test it on here. The BSDs use a different system.

Edit: If this doesn't work... find where Suse store the boot scripts for each init level and add the links for this one in a similar manner to how it's done above.

kehtahui 07-02-2006 11:24 PM

Quote:

Originally Posted by frob23
Okay, don't put it in .xinitrc. And don't start KDE. You're not running a window manager on this machine, are you? You just want a terminal into it.

I realize that I didn't tell you how to set it up at boot and to properly shutdown.

Save the following as /etc/rc.d/statwindow
Code:

#!/bin/sh
#This is a script to control the remote terminal window
#program.

case $1 in
    start)
        su lennon -c /export/home/users/lennon/window.sh
        ;;
    stop)
        for pid in `ps aux | grep xterm | awk '{print $2}'`
        do
            kill $pid
        done
        ;;
    *)
        echo "Unknown command."
        ;;
esac

The do the following:
Code:

cd /etc/rc.d/rc3.d
chmod +x ../statwindow
ln ../statwindow S99statwindow
ln ../statwindow K22statwindow

This should take care of it for you. Note, linux distros are often slightly different in how they boot... but this should work. I also admit that I hesitated to offer advice on that specific part because I don't use linux daily and don't even have a spare system to test it on here. The BSDs use a different system.

Edit: If this doesn't work... find where Suse store the boot scripts for each init level and add the links for this one in a similar manner to how it's done above.


Hi Frob23,

Thanks for your assitance. I put the statwindow script in rc.d and make it run at level 3 however the xterm is still unable to pop-up on remote workstation after boot-up. I try to look around and see what I can do, many thanks Frob23.

kehtahui 07-03-2006 02:33 AM

Hi all,

I'm using crontab to execute xterm and display on remote workstation, i also check the process id of xterm to ensure that it will only pop-up only single xterm on remote workstation.


All times are GMT -5. The time now is 10:59 PM.