Skip to content
Snippets Groups Projects
Commit 773aab30 authored by Bob Mottram's avatar Bob Mottram
Browse files

Ensure that any stuck notification process gets killed

parent 76224ed8
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,16 @@ SUBJECT=
MESSAGE=
COMPLETION_FILE=/root/${PROJECT_NAME}-completed.txt
function kill_xsend_process {
# Sometimes the process can get stuck, so ensure that
# it gets killed if necessary
# shellcheck disable=SC2009
xsend_pid=$(ps ax | grep /tmp/xsend | grep -v grep | awk -F ' ' '{print $1}')
if [ "$xsend_pid" ]; then
kill -9 "$xsend_pid"
fi
}
while [ $# -gt 1 ]
do
key="$1"
......@@ -139,9 +149,12 @@ if [ -d /etc/prosody ]; then
MESSAGE="$SUBJECT"
fi
kill_xsend_process
echo "$MESSAGE" | python2 /tmp/xsend "$ADMIN_EMAIL_ADDRESS"
systemctl restart prosody
rm /tmp/xsend
kill_xsend_process
fi
prosodyctl deluser "notification@$HOSTNAME"
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment