#!/bin/bash
#
# clearWxAlert
#
# $Id: clearWxAlerts 61 2011-01-30 16:08:13Z  $
# Clears and removes playWxAlertBg lockfiles.  This script should be used
# when debugging or during a force clear of alerts.  The main function
# is to remove all of the playWxAlertBg programs, remove all lock files.
#

# Load config file

if [ -f ${CUSTOM}/wx_scripts.conf ] ; then
    source ${CUSTOM}/wx_scripts.conf
else
    echo "Missing ${CUSTOM}/wx_scripts.conf file, aborting..."
    exit 1
fi

# Variables
WXALERTDIR=${WXALERT_SPOOLDIR}

# Check if any playWxAlertBg files are running, if so, killem
echo -n "Stopping Weather Alert Messages..."
killall playWxAlertBg &> /dev/null 2>&1
echo "     Done."


# cleanup the lock files
echo -n "Removing lock files from /tmp..."
rm -f /tmp/playWxAlertBg-lock &> /dev/null 2>&1
echo "     Done."

# clean up the Alert directories
echo -n "Cleaning up the alert weather directories..."
rm -f $WXALERTDIR/*/* &> /dev/null 2>&1
echo "     Done."

# clean up the tmp Wx Directories
echo -n "Removing temporary files in /tmp/wx.."
rm -f /tmp/wx/*/* &> /dev/null 2>&1
echo "     Done."

