-
Notifications
You must be signed in to change notification settings - Fork 0
/
reload_scheduler.sh
51 lines (47 loc) · 1.32 KB
/
reload_scheduler.sh
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
#!/bin/bash
COMANDO=$0
ARGUMENTO=$1
TIMESTAMP=`date +"%Y-%m-%d %T"`
QUEM=`whoami`
QUAL=`hostname -s`
function reload_scheduler_(){
if [ ${QUEM} == "sc-tos-app" ] ; then
echo "${TIMESTAMP} Error - Parando o Scheduler da Athenas no ${QUAL}" | tee -a ~/reload.log
ssh leitao@localhost "sudo /usr/local/bin/stop_scheduler.sh"
sleep 2
echo "${TIMESTAMP} Iniciando o Scheduler da Athenas no ${QUAL}" | tee -a ~/reload.log
ssh leitao@localhost "sudo /usr/local/bin/start_scheduler.sh"
sleep 2
ssh leitao@localhost "sudo /usr/local/bin/status_scheduler.sh"
if [ ${TAIL} -eq "1" ] ; then
ssh leitao@localhost "sudo /usr/bin/journalctl -f -u athenas-scheduler.service"
fi
else
echo "${TIMESTAMP} Error - Este comando deveria ser executado apenas pelo usuário sc-tos-app" | tee -a ~/reload.log ;
exit 2 ;
fi
}
function arruma_param_(){
case "${ARGUMENTO}" in
-v|--verbose)
TAIL=1
echo "Server: ${QUAL}"
;;
*)
TAIL=0
echo "Server: ${QUAL}"
;;
esac
reload_scheduler_;
}
function main_(){
case "${ARGUMENTO}" in
-h|--help)
ajuda_;
;;
*)
arruma_param_;
;;
esac
}
main_;