Commit e0b62283 authored by Dan Reading's avatar Dan Reading
Browse files

checkpoint. Work on getting test to run from Admin-MFS and using static...

checkpoint. Work on getting test to run from Admin-MFS and using static binaries from a NFS location.
parent 8a7fd21a
......@@ -11,11 +11,28 @@ declare host #emulab hostname
declare failed="" #major falure to be commicated to user
declare os="" #[Linux|FreeBSD] for now
# which is not in busybox and not a bash builtin
which() {
mypath=$(env | grep PATH)
mypath=${mypath/PATH=/}
mypath=${mypath//:/ }
for i in $mypath ; do
if [ -e $i/$1 ] ; then
echo $i/$1
return 0
fi
done
return 1
}
inithostname() {
os=`uname -s`
host=`hostname`
if [ -e "/var/emulab/boot/realname" ]; then
host=`cat /var/emulab/boot/realname`
elif
[ -e "/var/emulab/boot/nodeid" ]; then
host=$(cat /var/emulab/boot/nodeid)
fi
return 0
}
......
......@@ -40,6 +40,13 @@ system("echo 'Running nodechecks'");
$host = `hostname`;
if ( -r '/var/emulab/boot/realname' ) {
$host = `cat /var/emulab/boot/realname`;
} elsif ( -f '/var/emulab/boot/nodeid' ) {
$host = `cat /var/emulab/boot/nodeid`;
}
my $os = `uname -s`;
chomp($os);
if ($os eq "Linux") {
$ENV{'PATH'} = "/usr/local/bin:/proj/emulab-ops/nodecheck/bin_linux:$ENV{'PATH'}";
}
if (!$ARGV[0]) {
......@@ -59,6 +66,7 @@ if ($action eq "boot") {
system("echo '-- Finish boot_time_node_check --' >> /var/emulab/logs/nodecheck.log");
if ( -e "/tmp/nodecheck.log.tb" ) {
system("cp /tmp/nodecheck.log.tb /proj/emulab-ops/nodecheck/$host");
system("chmod a+r /proj/emulab-ops/nodecheck/$host");
}
} else {
system("rm -f /tmp/nodecheck.log.tb");
......
......@@ -15,12 +15,20 @@ if [ -r /etc/emulab/paths.sh ]; then
else
BINDIR=/etc/testbed
fi
if [ "`uname -s`" = "FreeBSD" ]; then
PATH=/usr/local/bin:/proj/emulab-ops/nodecheck/bin_freebsd:$PATH
export PATH
fi
# FREEBSD
host=`hostname`
if [ -e "/var/emulab/boot/realname" ]; then
host=$(cat /var/emulab/boot/realname)
elif
[ -e "/var/emulab/boot/nodeid" ]; then
host=$(cat /var/emulab/boot/nodeid)
fi
#checks="disk cpu mem time nic diskspeed"
......@@ -33,17 +41,18 @@ if [ "$1" = "boot" ] ; then
$(cp /dev/null /tmp/nodecheck.log.tb)
for i in $checks
do
/usr/local/bin/bash /usr/local/etc/emulab/${i}check /var/emulab/logs/nodecheck.log /tmp/nodecheck.log.tb
bash /usr/local/etc/emulab/${i}check /var/emulab/logs/nodecheck.log /tmp/nodecheck.log.tb
done
$(echo "-- Finish boot_time_node_check --" >> /var/emulab/logs/nodecheck.log)
if [ -f /tmp/nodecheck.log.tb ] ; then
cp /tmp/nodecheck.log.tb /proj/emulab-ops/nodecheck/$host
chmod a+r /proj/emulab-ops/nodecheck/$host
fi
else
$(rm -f /tmp/nodecheck.log.tb)
for i in $checks
do
/usr/local/bin/bash /usr/local/etc/emulab/${i}check /var/emulab/logs/nodecheck.log
bash /usr/local/etc/emulab/${i}check /var/emulab/logs/nodecheck.log
done
fi
......
......@@ -3,7 +3,29 @@
arg=$1
#list="pc4 pc7 pc133 pc137 pc207 pc208 pc406 pc446 pc511 pc606"
list=$(mysql -B -N -e "select node_id from reserved where pid='emulab-ops' and eid='nodecheck-image';" tbdb)
if [ "${arg}" == "static" ] ; then
here=$(pwd)
if [ -d "bin_FreeBSD_static" ] ; then
cd bin_FreeBSD_static
stuff=$(ls)
if [ -n "${stuff}" ] ; then
sudo rsync -a -P * /proj/emulab-ops/nodecheck/bin_freebsd
fi
cd $here
fi
if [ -d "bin_Linux_static" ] ; then
cd bin_Linux_static
stuff=$(ls)
if [ -n "${stuff}" ] ; then
sudo rsync -a -P * /proj/emulab-ops/nodecheck/bin_linux
fi
cd $here
fi
exit 0
fi
list=$(mysql -B -N -e "select node_id from reserved where pid='emulab-ops' and eid='adminnodecheck';" tbdb)
machines=""
......@@ -98,7 +120,8 @@ EOF
for i in $machines
do
echo "$i rc.config "
sudo rsync -a rc/rc.config ${i}:/usr/local/etc/emulab/rc/rc.config
# sudo rsync -a rc/rc.config ${i}:/usr/local/etc/emulab/rc/rc.config
sudo scp -p rc/rc.config ${i}:/usr/local/etc/emulab/rc/rc.config
# sudo ssh ${i} chown root /usr/local/etc/emulab/rc/rc.config
# sudo ssh ${i} chgrp 0 /usr/local/etc/emulab/rc/rc.config
done
......@@ -123,7 +146,10 @@ done
for i in $machines
do
echo "${i}:utils "
sudo rsync -a ${utils} ${i}:/usr/local/etc/emulab
# sudo rsync -a ${utils} ${i}:/usr/local/etc/emulab
for u in ${utils} ; do
scp -p $u ${i}:/usr/local/etc/emulab
done
# sudo ssh ${i} "cd /usr/local/etc/emulab ; chown root ${utils} "
# sudo ssh ${i} "cd /usr/local/etc/emulab ; chgrp 0 ${utils} "
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment