forked from VickScarlet/lifeRestart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
executable file
·32 lines (30 loc) · 1.08 KB
/
launch.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
#!/usr/bin/env bash
echo -e "\033[32m"
echo "##############################################"
echo "# Samsara Auto-Launch-Script #"
echo "##############################################"
echo "#dist: build locally, upload dist to server #"
echo "##############################################"
echo -e "\033[0m"
if [ $# = 1 ];then
if [ $1 = "lab" ];then
echo "server: 129.69.167.58"
addr="[email protected]"
path="/var/www"
tar -cf c_dist.tar public
read -s -n1 -p "please enter the passwd to upload dist, press anykey to continue..."
echo ""
scp -r c_dist.tar $addr:$path
read -s -n1 -p "please enter the passwd again to overwrite dist, press anykey to continue..."
echo ""
ssh -tt "$addr" "cd $path && sudo rm -rf samsara && sudo tar -xvf c_dist.tar && sudo mv public samsara && sudo rm c_dist.tar"
else
echo "Usage: $0 [lab]"
echo "You provided $1 as parameter 1."
exit
fi
else
echo "Usage: $0 [lab]"
echo "You provided $# parameters,but 1 is required."
exit
fi