-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_script.sh
More file actions
39 lines (32 loc) · 827 Bytes
/
run_script.sh
File metadata and controls
39 lines (32 loc) · 827 Bytes
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
#! /bin/bash
TMP_RSS_LOCK="/tmp/rss.lock"
if [ -e ${TMP_RSS_LOCK} ]; then
echo "Another instance of rss script is running. Aborting."
exit
else
touch $TMP_RSS_LOCK
# run python script to update rss feed
RSS_ENGINE_PATH="/root/rss/rss-engine/"
REPO_PATH="/root/rss/XinArkh.github.io/"
OUTPUT_PATH=${REPO_PATH}"rss/"
echo `date`
echo "--- updating rss feed... ---"
python ${RSS_ENGINE_PATH}run_script.py -o $OUTPUT_PATH
echo "--- rss feed updated! ---"
# upload rss feed to github repo
CRTDIR=$(pwd)
# CRTDATE=$(date "+%Y-%m-%d")
CRTDATE=$(date)
echo "--- uploading rss feed to github repo... ---"
cd $REPO_PATH
git pull
git add rss/*.xml
git commit -m "rss feed auto update: ${CRTDATE}"
git push
cd $CRTDIR
echo "--- rss feed uploaded! ---"
echo "--- rss feed auto update done! ---"
echo
echo
rm $TMP_RSS_LOCK
fi