moved includes and cleaned up paths

This commit is contained in:
root 2018-05-17 16:11:27 +02:00
parent 1490a96f14
commit e7525fda56
45 changed files with 15 additions and 10 deletions

View file

@ -1,11 +1,12 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SSH_IP="127.0.0.1"
SSHPORT="2322"
SSH_USER="command"
SSH_SUCCESS_FILE="/tmp/chch-status_ssh-success"
JSON_FILE="/var/www/chch_api/chch.json"
JSON_FILE_TEMPL="/etc/chch/chch.json.template"
JSON_FILE_TEMPL="$SCRIPT_DIR/include/chch.json.template"
JSON_FILE_TMP="$(mktemp)"
STATUS_FILE="/tmp/chch-status"
STATUS_OPEN="geöffnet"
@ -34,7 +35,7 @@ if [ -z "$STATUS" ]; then
STATUS="$STATUS_NULL"
fi
else
touch $SSH_SUCCESS_FILE
touch "$SSH_SUCCESS_FILE"
fi
TIMESTAMP_LASTCHANGE=$(stat -c '%Y' "$STATUS_FILE" 2>/dev/null) || TIMESTAMP_LASTCHANGE=$(date +%s)
@ -82,10 +83,10 @@ case $STATUS in
esac
# The status file for spaceapi.ccc.de and for our IRC bot.
sed "s/%%STATUS%%/${API_STATUS}/;s/%%MESSAGE%%/${API_STATUS_MSG}/;s/%%LASTCHANGE%%/${TIMESTAMP_LASTCHANGE}/" $JSON_FILE_TEMPL > $JSON_FILE_TMP
chown --reference=$JSON_FILE_TEMPL $JSON_FILE_TMP
chmod --reference=$JSON_FILE_TEMPL $JSON_FILE_TMP
mv $JSON_FILE_TMP $JSON_FILE
sed "s/%%STATUS%%/${API_STATUS}/;s/%%MESSAGE%%/${API_STATUS_MSG}/;s/%%LASTCHANGE%%/${TIMESTAMP_LASTCHANGE}/" "$JSON_FILE_TEMPL" > "$JSON_FILE_TMP"
chown --reference="$JSON_FILE_TEMPL" "$JSON_FILE_TMP"
chmod --reference="$JSON_FILE_TEMPL" "$JSON_FILE_TMP"
mv "$JSON_FILE_TMP" "$JSON_FILE"
echo -n "$WIKI_STATUS" | php "$WIKI_PATH/maintenance/edit.php" -m -b --no-rc -s "$STATUS" "$WIKI_STATUS_PAGE" >> /dev/null 2>&1
echo "$WIKI_MAIN_PAGE" | php "$WIKI_PATH/maintenance/purgeList.php" --purge >> /dev/null 2>&1