forked from dspani/covid19
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
33 lines (31 loc) · 1.12 KB
/
deploy.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
#!/bin/bash
echo "Running as $(whoami)"
[ "$UID" -eq 0 ] || exec sudo "$0" "$@"
echo "Stopping nginx--------"
sudo systemctl stop nginx
echo "Making /deploy--------"
sudo mkdir -p /deploy
echo "Deleting outdated websites--------"
sudo rm -rf /var/www/covnews.org/html/index.html
sudo rm -rf /var/www/covnews.org/html/submit.php
sudo rm -rf /var/www/covnews.org/html/style.css
sudo rm -rf /var/www/covnews.org/html/image.ico
echo "Deleting outdated scripts--------"
sudo rm -rf /deploy/*
echo "Deleting covid19 and its content--------"
rm -rf ~/covid19
echo "Cloning git--------"
git clone https://github.com/dspani/covid19
echo "Moving new websites--------"
sudo cp ~/covid19/website/* /var/www/covnews.org/html/
echo "Deploying scripts--------"
cp ~/covid19/*.py /deploy/
cp ~/covid19/secret/ini /deploy/
cp ~/covid19/secret/push_notifications.sh /deploy/
echo "Changing permission--------"
sudo chmod +x /deploy/push_notifications.sh
echo "Restarting server--------"
sudo systemctl restart nginx
echo "-------- Done --------"
echo "You should still add [access_key] and [secret_key] in"
echo "/deploy/ini and /deploy/push_notifications.sh"