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 () { ...@@ -20,14 +20,8 @@ remindUser () {
(( counter += 1 )) (( counter += 1 ))
if [[ "$counter" -ge "$maxCounter" ]] || [[ "$counter" -ge 6 ]] && [[ "$2" != "none" ]] && [[ "$textSent" == 0 ]] if [[ "$counter" -ge "$maxCounter" ]] || [[ "$counter" -ge 6 ]] && [[ "$2" != "none" ]] && [[ "$textSent" == 0 ]]
then then
if [[ $(grep Ubuntu /etc/os-release) ]] bash /opt/ornltoolbox/resources/app/badgeManagement/badgeMinder/badgeMinder-emailer.sh "${2}${3}"
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
#Text has been sent, don't send another #Text has been sent, don't send another
textSent=1 textSent=1
fi fi
...@@ -43,12 +37,7 @@ remindUser () { ...@@ -43,12 +37,7 @@ remindUser () {
#Send text reminder immediately, beeping is disabled #Send text reminder immediately, beeping is disabled
if [[ "$2" != "none" ]] && [[ "$1" == 0 ]] if [[ "$2" != "none" ]] && [[ "$1" == 0 ]]
then then
if [[ $(grep Ubuntu /etc/os-release) ]] bash /opt/ornltoolbox/resources/app/badgeManagement/badgeMinder/badgeMinder-emailer.sh "${2}${3}"
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
fi fi
} }
......
...@@ -4,12 +4,7 @@ source ~/.config/ornltoolbox/badgeMinder.config ...@@ -4,12 +4,7 @@ source ~/.config/ornltoolbox/badgeMinder.config
#If enabled, test text reminder #If enabled, test text reminder
if [[ "$phone" != "none" ]] if [[ "$phone" != "none" ]]
then then
if [[ $(grep Ubuntu /etc/os-release) ]] bash /opt/ornltoolbox/resources/app/badgeManagement/badgeMinder/badgeMinder-emailer.sh "${2}${3}"
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
fi fi
#If enabled, test beep reminder #If enabled, test beep reminder
......
...@@ -6,7 +6,7 @@ if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then ...@@ -6,7 +6,7 @@ if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then
else else
BRANCH="-${CI_COMMIT_REF_NAME}" BRANCH="-${CI_COMMIT_REF_NAME}"
fi fi
VERSION_NUMBER='1.0.10' VERSION_NUMBER='1.0.11'
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh 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 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