| MonkeyBrains.net/~rudy/example | Random examples |
set-console-up.sh
Want console access? Here is how! |
|---|
|
Console access is great -- especially when doing major upgrades remotely.
Console access has thress stages:
This script will set up a FreeBSD box to send boot loader info to the console (so you can single-user-mode) and will configure the running system to allow logins via console as well.
#!/bin/sh
### set-console-up.sh
### MonkeyBrains script to quickly 'activate' console on FreeBSD (and linux?) boxes.
### - Rudy
OS=`uname`;
echo -n `hostname`
if [ $OS = 'FreeBSD' ]; then
echo " On $OS machine."
# set getty on console port.
echo -n " -- old ttys -- "
grep ttyd0 /etc/ttys
perl -pi -e 's,(ttyd0\s+"/usr/libexec/getty std.9600"\s+)dialup\s+off,${1}vt100\ton ,' /etc/ttys
echo -n " -- new ttys -- "
grep ttyd0 /etc/ttys
echo " ++ Telling init to reread ttys file. ++ "
kill -HUP 1
if [ ! -f /boot/loader.conf ]; then
echo " Creating /boot/loader.conf"
(echo -n '# Created: ' && date) >> /boot/loader.conf
fi
CHECK=`grep -c '^console="comconsole"' /boot/loader.conf`
if [ $CHECK = 0 ]; then
echo " Updating loader.conf"
echo 'console="comconsole"' >> /boot/loader.conf
else
echo " Already set"
fi
grep comcon /boot/loader.conf
elif [ $OS = 'Linux' ]; then
echo " On $OS machine."
perl -pi -e 's/^#T0:/T0:/' /etc/inittab
echo " -- telling init to reread the /etc/inittab file --"
/sbin/telinit q
else
echo " unrecognized OS: $OS"
exit
fi
echo " *********** All done! Test! ***********"
|
| Search the web for more info! (I'll add some info here when I get my Old Xyplex running (got it for free out of the trash)). |