Commit 271fee3e authored by Tristan A Spakes's avatar Tristan A Spakes

Created new .sh script for badge minder email

parent 2f3d45f1
Pipeline #23037 passed with stages
in 1 minute and 6 seconds
#! /bin/bash
RECIPIENT="$1"
SUBJECT='Badge Reminder'
BODY='You left your badge in your computer'
EMAIL="HELO ${HOSTNAME}
MAIL FROM: no-reply@ornl.gov
RCPT TO: ${RECIPIENT}
DATA
From: <${USER}@ornl.gov>
To: <${RECIPIENT}>
Date: $(date "+%a, %d %b %Y %H:%M:%S %z")
Subject: ${SUBJECT}
${BODY}
.
QUIT
"
echo "${EMAIL}" > /dev/tcp/smtp.ornl.gov/25
......@@ -20,14 +20,8 @@ remindUser () {
(( counter += 1 ))
if [[ "$counter" -ge "$maxCounter" ]] || [[ "$counter" -ge 6 ]] && [[ "$2" != "none" ]] && [[ "$textSent" == 0 ]]
then
if [[ $(grep Ubuntu /etc/os-release) ]]
then
#For Ubuntu
echo "You left your badge in your computer" | s-nail -S smtp=smtp.ornl.gov:25 -r "no-reply@ornl.gov" -s "Badge Reminder" "$2""$3"
else
#For RHEL7
echo "You left your badge in your computer" | mailx -S smtp=smtp.ornl.gov:25 -r "no-reply@ornl.gov" -s "Badge Reminder" "$2""$3"
fi
bash /opt/ornltoolbox/resources/app/badgeManagement/badgeMinder/badgeMinder-emailer.sh "${2}${3}"
#Text has been sent, don't send another
textSent=1
fi
......@@ -43,12 +37,7 @@ remindUser () {
#Send text reminder immediately, beeping is disabled
if [[ "$2" != "none" ]] && [[ "$1" == 0 ]]
then
if [[ $(grep Ubuntu /etc/os-release) ]]
then
echo "You left your badge in your computer" | s-nail -S smtp=smtp.ornl.gov:25 -r "no-reply@ornl.gov" "$2""$3"
else
echo "You left your badge in your computer" | mailx -S smtp=smtp.ornl.gov:25 -r "no-reply@ornl.gov" "$2""$3"
fi
bash /opt/ornltoolbox/resources/app/badgeManagement/badgeMinder/badgeMinder-emailer.sh "${2}${3}"
fi
}
......
......@@ -4,12 +4,7 @@ source ~/.config/ornltoolbox/badgeMinder.config
#If enabled, test text reminder
if [[ "$phone" != "none" ]]
then
if [[ $(grep Ubuntu /etc/os-release) ]]
then
echo "You left your badge in your computer" | s-nail -S smtp=smtp.ornl.gov:25 -r "no-reply@ornl.gov" "$phone""$carrier"
else
echo "You left your badge in your computer" | mailx -S smtp=smtp.ornl.gov:25 -r "no-reply@ornl.gov" "$phone""$carrier"
fi
bash /opt/ornltoolbox/resources/app/badgeManagement/badgeMinder/badgeMinder-emailer.sh "${2}${3}"
fi
#If enabled, test beep reminder
......
......@@ -6,7 +6,7 @@ if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then
else
BRANCH="-${CI_COMMIT_REF_NAME}"
fi
VERSION_NUMBER='1.0.10'
VERSION_NUMBER='1.0.11'
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum -y install nodejs npm ruby-devel gcc make rpm-build rubygems
......
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