Commit f77289cb authored by Robert Dietrich's avatar Robert Dietrich

remove old diamond logs and prope debug directory

parent 2983cecd
#!/bin/bash
# install pika python and likwid in /opt/pika if it is not already installed
if [ ! -d "${PIKA_INSTALL_PATH}" ]; then
echo -e "\n${PIKA_INSTALL_PATH} does not exist" >> $DEBUG_PATH 2>&1
# create a simple lock via mkdir
mkdir $lock_collectd 2> /dev/null #returns 1, if directory already exists
# check if directory could be successfully created
# ensures that only one prolog instance is installing PIKA
if [ $? == 0 ]; then
trap "rm -rf ${lock_collectd}" QUIT TERM EXIT INT # ensure that lock is released on exit
have_setup_lock=true
echo -e "\nInstall/Replace PIKA software stack to ${PIKA_INSTALL_PATH}" >> $DEBUG_PATH 2>&1
# check if an old collectd daemon is still running, if so kill it
echo -e "\nCheck if an old PIKA Collectd is still running" >> $DEBUG_PATH 2>&1
DAEMON="pika_collectd"
COLLECTD_PID=`ps -eo pid,cmd | grep -v grep | grep "$DAEMON" | awk '{print $1}'`
if [ -z "$COLLECTD_PID" ]; then
echo -e "Collectd is not running." >> $DEBUG_PATH 2>&1
else
echo -e "\nTerminate old PIKA Collectd processes: $COLLECTD_PID" >> $DEBUG_PATH 2>&1
kill -TERM $COLLECTD_PID
sleep 1 # give the terminate a chance
# make sure that collectd processes are killed
old_pika_collectd_procs=`ps -eo pid,cmd | grep -v grep | grep -c "$DAEMON"`
if [ $old_pika_collectd_procs -gt 0 ]; then
echo -e "\nkill -KILL $COLLECTD_PID" >> $DEBUG_PATH 2>&1
kill -KILL $COLLECTD_PID >> $DEBUG_PATH 2>&1
fi
# check if the hard kill worked
old_pika_collectd_procs=`ps -eo pid,cmd | grep -v grep | grep -c "$DAEMON"`
if [ $old_pika_collectd_procs -gt 0 ]; then
echo -e "\nError: Could not terminate old PIKA Collectd processes. ${old_pika_collectd_procs} are still running." >> $DEBUG_PATH 2>&1
fi
fi
# delete old PIKA installation, except for the new version
#cd ${PIKA_INSTALL_PATH}/..
#old_pika_count=`ls | wc -l`
#if [ $old_pika_count -gt 1 ]; then
# echo -e "\nDelete $old_pika_count old /opt/pika installations." >> $DEBUG_PATH 2>&1
# rm -rf $(ls | grep -v ${PIKA_VERSION})
#fi
if [ -d "/opt/pika" ]; then
echo -e "rm -rf /opt/pika" >> $DEBUG_PATH 2>&1
rm -rf /opt/pika
fi
# temporary: delete old prope installations
if [ -d "/opt/prope" ]; then
echo -e "rm -rf /opt/prope" >> $DEBUG_PATH 2>&1
rm -rf /opt/prope
echo -e "rm -f /tmp/diamond.*" >> $DEBUG_PATH 2>&1
rm -f /tmp/diamond.*
echo -e "rm -rf /tmp/prope_debug" >> $DEBUG_PATH 2>&1
rm -rf /tmp/prope_debug
fi
# create the install directory
mkdir -p ${PIKA_INSTALL_PATH}
echo -e "tar xzf ${PIKA_PACKAGE_PATH} -C ${PIKA_INSTALL_PATH}/.." >> $DEBUG_PATH 2>&1
tar xzf ${PIKA_PACKAGE_PATH} -C ${PIKA_INSTALL_PATH}/.. >> $DEBUG_PATH 2>&1
# unlock (collectd is ready to be started)
# rm -rf ${lock_collectd}
fi
fi
Markdown is supported
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