X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pl_mop.sh;h=80fcb4175d5fc7c5d7dbc7a8be2da75a33c3d56d;hb=296cf549b886283d41da69b8b0477788e11d8186;hp=e40b872d31615b3ee48379ab621cd99265ff9394;hpb=10c81030eb73f2cd7d8ac83565ec14932cf6f7a5;p=mom.git diff --git a/pl_mop.sh b/pl_mop.sh index e40b872..80fcb41 100755 --- a/pl_mop.sh +++ b/pl_mop.sh @@ -5,11 +5,18 @@ # Mark Huang # Copyright (C) 2005 The Trustees of Princeton University # -# $Id: pl_mop.sh,v 1.3 2005/12/01 23:38:58 mlhuang Exp $ +# $Id: pl_mop.sh,v 1.8 2007/02/14 20:48:46 faiyaza Exp $ # PATH=/sbin:/usr/sbin:$PATH +# Parse PLC configuration +if [ -r /etc/planetlab/plc_config ] ; then + . /etc/planetlab/plc_config +else + PLC_SLICE_PREFIX="pl" +fi + PIDFILE=/var/run/pl_mop.pid # Record PID @@ -46,7 +53,7 @@ fix_etc_shadow() { # keep essential services running restart_services() { - for service in sshd pl_sshd pl_mom pl_nm proper ; do + for service in sshd pl_sshd swapmon nm proper ; do echo "* Checking $service" status=$(service $service status) if [ $? -ne 0 ] || echo $status 2>&1 | grep -q stopped ; then @@ -68,15 +75,46 @@ restart_netflow() { fi } -# keep pl_conf running -restart_pl_conf() { - echo "* Checking pl_conf" - vserver pl_conf exec /sbin/service pl_conf status >/dev/null 2>&1 - if [ $? -ne 0 ] ; then - echo "* Restarting pl_conf" - vserver pl_conf restart +# GPG keys are installed in /etc/pki/rpm-gpg by both the Boot Manager +# during initial installation, and by PlanetLabConf during daily +# updates. NodeUpdate imports the keys into the RPM database before +# running yum daily. vserver-reference copies and imports the keys +# into the reference images and system slices daily. The only parts of +# this process that are actually necessary, are the Boot Manager and +# vserver-reference. However, we do not want to force a re-install of +# all nodes, and we do not want to force an update of +# vserver-reference, so in the meantime, PlanetLabConf and NodeUpdate +# take care of getting the keys installed and imported in /, and this +# script takes care of getting them installed in the reference images +# and system slices, until we can get a new vserver-reference image +# pushed out. +update_vserver_reference() { + echo "* Updating VServer reference" + + shopt -s nullglob + + VROOTS="/vservers/vserver-reference /vservers/.vcache/* /vservers/${PLC_SLICE_PREFIX}_*" + + # Copy configuration files from host to slices + for file in \ + /etc/hosts /etc/resolv.conf /etc/yum.conf /etc/planetlab/node_id \ + /etc/planetlab/plc_config* /etc/planetlab/php/* \ + /etc/pki/rpm-gpg/* ; do + if [ -r $file ] ; then + for vroot in $VROOTS ; do + install -D -m 644 $file $vroot/$file + done + fi + done + + # (Re)install GPG signing keys + if [ -d /etc/pki/rpm-gpg ] ; then + for vroot in $VROOTS ; do + chroot $vroot rpm --allmatches -e gpg-pubkey || : + chroot $vroot rpm --import /etc/pki/rpm-gpg/* || : + done fi -} +} # kill all the processes running in slice contexts vkillall() { @@ -175,8 +213,8 @@ run fix_etc_shadow run restart_services -run restart_pl_conf - run restart_netflow run kill_duplicate_ssh + +run update_vserver_reference