-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjitsiUrl.bash
executable file
·66 lines (43 loc) · 1.65 KB
/
jitsiUrl.bash
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
61
62
63
64
65
66
#!/usr/bin/env bash
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Dir of the script
__root="$(cd "$(dirname "${__dir}")" && pwd)" # Dir of the dir of the script
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")" # Full path of the script
__base="$(basename ${__file})" # Name of the script
ts=`date +'%Y%m%d-%H%M%S'`
ds=`date +'%Y%m%d'`
pid=`ps -ef | grep ${__base} | grep -v 'vi ' | head -n1 | awk ' {print $2;} '`
formerDir=`pwd`
#Set the config file
configFile="$HOME/.binJlam/$__base.conf"
defaultBase=https://meet.jit.si/
arg1=${1:-''}
if [[ $arg1 == '--help' || $arg1 == '-h' ]]; then
echo "Usage: $0 \$meetingTopic \$baseUrl"
echo "You can use $configFile like defaultBase=\$baseUrl to override the default $defaultBase"
exit 0
fi
#exit when command fails (use || true when a command can fail)
set -o errexit
#exit when your script tries to use undeclared variables
set -o nounset
# in scripts to catch mysqldump fails
set -o pipefail
# If you require named arguments, see
# http://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
export DISPLAY=:0
#echo Begin `date` .....
#echo; echo; echo;
### BEGIN SCRIPT ###############################################################
#(a.k.a set -x) to trace what gets executed
#set -o xtrace
if [ -f $configFile ]; then
. $configFile
fi
meetingTopic=$1
baseUrl=${2:-"$defaultBase"}
hash=$(echo $meetingTopic | sha1sum | cut -c 1-10)
echo $baseUrl/$meetingTopic-$hash
set +x
### END SCIPT ##################################################################
cd $formerDir