-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.sh
executable file
·47 lines (35 loc) · 1.02 KB
/
cmd.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
#!/usr/bin/env bash
#set -o errexit
set -o nounset
set -o pipefail
cd "$(dirname "$0")"
RED=`tput setaf 1`
GREEN=`tput setaf 2`
BOLD=`tput bold`
RESET=`tput sgr0`
run() {
flask --app frontend.py run -p 32168
}
deploy() {
local HOST_INFO_FILE=remote.txt
# Expect a certain data to be on a specific line.
local REMOTE_PASSWORD=$(sed -n 1p $HOST_INFO_FILE)
local REMOTE_SERVER=$(sed -n 2p $HOST_INFO_FILE)
local REMOTE_USER=$(sed -n 3p $HOST_INFO_FILE)
rsync -v \
--exclude '.git' \
--exclude '__pycache__' \
--exclude 'venv' \
-- * "$REMOTE_USER"@"$REMOTE_SERVER":~/silly-comments/
}
kill() {
local HOST_INFO_FILE=remote.txt
# Expect a certain data to be on a specific line.
local REMOTE_PASSWORD=$(sed -n 1p $HOST_INFO_FILE)
local REMOTE_SERVER=$(sed -n 2p $HOST_INFO_FILE)
local REMOTE_USER=$(sed -n 3p $HOST_INFO_FILE)
printf "Killing frontend.py...\n"
pid=$(ssh "$REMOTE_USER"@"$REMOTE_SERVER" ps ax | grep frontend.py | awk '{print $1}')
printf "frontend.py PID: %d\n" "$pid"
}
"$@"