Compare commits
6 Commits
5258bb012e
...
tls
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42b823dd31 | ||
|
|
62232d6828 | ||
|
|
dd7f08ffcd | ||
|
|
58e384b02c | ||
|
|
2a470306ce | ||
|
|
68b2b3aa7b |
2
cbr.get
2
cbr.get
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
URL=https://www.cbr.ru/scripts/XML_daily.asp
|
URL=https://www.cbr.ru/scripts/XML_daily.asp
|
||||||
OUT=/var/www/html/cbr/cur.xml
|
OUT=/var/www/html/cbr.xml
|
||||||
wget $URL -O $OUT
|
wget $URL -O $OUT
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ server {
|
|||||||
|
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
|
|
||||||
|
# Add index.php to the list if you are using PHP
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
server_name _;
|
server_name _;
|
||||||
@@ -35,7 +36,6 @@ server {
|
|||||||
# as directory, then fall back to displaying a 404.
|
# as directory, then fall back to displaying a 404.
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
add_header "Access-Control-Allow-Origin" "*";
|
add_header "Access-Control-Allow-Origin" "*";
|
||||||
add_header "Cache-Control" "max-age=43200";
|
|
||||||
# Remove CORS.
|
# Remove CORS.
|
||||||
if ($request_method = "OPTIONS") {
|
if ($request_method = "OPTIONS") {
|
||||||
add_header "Access-Control-Allow-Origin" "*";
|
add_header "Access-Control-Allow-Origin" "*";
|
||||||
|
|||||||
50
publish.dbg
50
publish.dbg
@@ -1,50 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DST_DIR=/var/www/dbg
|
|
||||||
KMP_FILE=kornerr-ver-browser
|
|
||||||
KMP_FILE_EXT=js
|
|
||||||
MAIN_BRANCH=main
|
|
||||||
REPO_DIR=/home/kornerr/repo-ru
|
|
||||||
REPO_URL=https://github.com/kornerr/ru
|
|
||||||
|
|
||||||
# Clone if the directory does not exist
|
|
||||||
if [ ! -d "$REPO_DIR" ]; then
|
|
||||||
git clone $REPO_URL $REPO_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the latest changes
|
|
||||||
cd $REPO_DIR
|
|
||||||
git checkout -f $MAIN_BRANCH
|
|
||||||
git fetch --all
|
|
||||||
|
|
||||||
# Find out the latest commit in the whole repo
|
|
||||||
#git branch -av --sort=-committerdate
|
|
||||||
#git branch -av --sort=-committerdate | tr -s ' ' | head -n1
|
|
||||||
cmt=`git branch -av --sort=-committerdate | tr -s ' ' | head -n1 | cut -d' ' -f3`
|
|
||||||
echo "Latest commit: $cmt"
|
|
||||||
|
|
||||||
# Switch to the latest commit
|
|
||||||
git checkout -f $cmt
|
|
||||||
|
|
||||||
# Copy dist
|
|
||||||
mkdir -p $DST_DIR
|
|
||||||
rm -fR $DST_DIR/*
|
|
||||||
cp -R dist/* $DST_DIR
|
|
||||||
|
|
||||||
# Rename kornerr-ver-browser.js to work around caching
|
|
||||||
kmpWas=$KMP_FILE.$KMP_FILE_EXT
|
|
||||||
kmpNow=${KMP_FILE}_`uuidgen`.$KMP_FILE_EXT
|
|
||||||
mv $DST_DIR/$kmpWas $DST_DIR/$kmpNow
|
|
||||||
|
|
||||||
# Replace text in a file
|
|
||||||
function replace {
|
|
||||||
file=$1
|
|
||||||
was=$2
|
|
||||||
now=$3
|
|
||||||
cmd="sed -i 's|$was|$now|g' $file"
|
|
||||||
eval "$cmd"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Rename references
|
|
||||||
replace $DST_DIR/bank.html "$kmpWas" "$kmpNow"
|
|
||||||
replace $DST_DIR/quiz.html "$kmpWas" "$kmpNow"
|
|
||||||
15
publish.prod
15
publish.prod
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DBG_DIR=/var/www/dbg
|
|
||||||
DST_DIR=/var/www/html
|
|
||||||
|
|
||||||
# Remove current prod
|
|
||||||
rm -fR $DST_DIR
|
|
||||||
|
|
||||||
# Copy dbg to prod
|
|
||||||
rsync -aivc --delete $DBG_DIR/ $DST_DIR
|
|
||||||
|
|
||||||
# Symlink
|
|
||||||
cd $DST_DIR
|
|
||||||
ln -s ../cbr
|
|
||||||
ln -s ../dbg
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
CMD="0 20 * * * kornerr /home/kornerr/vps/publish.dbg"
|
|
||||||
CRON_FILE=/etc/cron.d/dbg
|
|
||||||
echo "$CMD" > $CRON_FILE
|
|
||||||
Reference in New Issue
Block a user