#!/bin/bash # # Copyrights : CNRS # Author : Oleg Lodygensky # Acknowledgment : XtremWeb-HEP is based on XtremWeb 1.8.0 by inria : http://www.xtremweb.net/ # Web : http://www.xtremweb-hep.org # # This file is part of XtremWeb-HEP. # # XtremWeb-HEP is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # XtremWeb-HEP is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XtremWeb-HEP. If not, see . # # # ****************************************************************** # File : xwcontext_epilogue # Date : August 31st, 2012 # Author : Oleg Lodygensky # # OS : Linux # Arch : noarch # # Purpose : contextualization - final steps after boot # contextualization disk is mounted on /mnt/xwcontext # this is HEPiX compliant contextualisation epilog # this is based on http://grid.desy.de/vm/hepix/vwg/doc/html/start/contextualisation-principles-cern-status.shtml # # Changelog: # $Log: vmcontext,v $ # Revision 1.2 2010/08/06 19:10:36 uschwick # add support for KVM # # Revision 1.1 2009/12/03 08:15:59 uschwick # import initial version of vmcontext from SG # # chkconfig: 2345 99 2 # description: XWHEP contextualization epilog LOGFILE=/var/log/xwcontext_epilogue.log start() { touch $LOGFILE echo -n $"XWHEP contextualization epilog: " cd /mnt/xwcontext >> $LOGFILE 2>&1 RETVAL=$? if [ 0 -eq $RETVAL ] ; then if [ -e /mnt/xwcontext/epilog.sh ]; then echo "Completing contextualization" >> $LOGFILE 2>&1 # . /mnt/xwcontext/epilog.sh # # In XWHEP, users are not allowed to run as root # We solve this, by the appropriate /etc/suders # echo "Launching /mnt/xwcontext/epilog.sh" >> $LOGFILE 2>&1 chmod +x /mnt/xwcontext/epilog.sh >> $LOGFILE 2>&1 /bin/su -l vmuser bash -c /mnt/xwcontext/epilog.sh >> $LOGFILE 2>&1 RETVAL=$? fi if [ -f /mnt/xwcontext/context.sh ] ; then echo "Launching /mnt/xwcontext/context.sh" >> $LOGFILE 2>&1 chmod uog+x /mnt/xwcontext/context.sh >> $LOGFILE 2>&1 /bin/su -l vmuser bash -c /mnt/xwcontext/context.sh >> $LOGFILE 2>&1 RETVAL=$? else echo "No contextualization epilog found" >> $LOGFILE 2>&1 RETVAL=0 fi fi if [ 0 -eq $RETVAL ]; then echo "[ OK ]" else echo "[ FAILED ]" fi echo "RETVAL=$RETVAL" >> $LOGFILE 2>&1 return $RETVAL } stop() { echo -n $"xwcontext_epilogue : unmouting context disk: " umount /mnt/xwcontext RETVAL=$? if [ 0 -eq $RETVAL ]; then echo "[ OK ]" else echo "[ FAILED ]" fi echo return $RETVAL } case "$1" in start) # [ $running -eq 0 ] && exit 0 start RETVAL=$? ;; stop) # [ $running -eq 0 ] || exit 0 stop RETVAL=$? ;; *) echo $"Usage: $0 {start|stop}" RETVAL=2 esac exit $RETVAL