This repository was archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathsend_msg.sh
More file actions
60 lines (49 loc) · 1.4 KB
/
send_msg.sh
File metadata and controls
60 lines (49 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
usage() { echo "Usage: send_msg -e <recipientEmail> -c <chatConnectionString> -q <chatMessageQueue> -m <message>" 1>&2; exit 1; }
declare recipientEmail=""
declare chatConnectionString=""
declare chatMessageQueue=""
declare message=""
# Initialize parameters specified from command line
while getopts ":e:c:q:m:" arg; do
case "${arg}" in
e)
recipientEmail=${OPTARG}
;;
c)
chatConnectionString=${OPTARG}
;;
q)
chatMessageQueue=${OPTARG}
;;
m)
message=${OPTARG}
;;
esac
done
shift $((OPTIND-1))
if [[ -z "$recipientEmail" ]]; then
echo "recipientEmail was not set properly"
read recipientEmail
fi
if [[ -z "$chatConnectionString" ]]; then
echo "chatConnectionString was not set properly"
read chatConnectionString
fi
if [[ -z "$chatMessageQueue" ]]; then
echo "chatMessageQueue was not set properly"
read chatMessageQueue
fi
if [[ -z "$message" ]]; then
echo "message was not set properly"
read message
fi
cd /home/azureuser/openhack-devops-proctor/provision-team/svcbusclient
# Restore the ServiceBus Package
dotnet add package Microsoft.Azure.ServiceBus --version 3.1.0
# build the servicebus client app
dotnet build
# send the message to servicebus
dotnet run $chatConnectionString $chatMessageQueue $recipientEmail $message