Skip to content

Commit

Permalink
[Meta] Add daily.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
lost1227 committed Oct 25, 2023
1 parent 226c59d commit 09848c3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
7 changes: 6 additions & 1 deletion deploy/deploy.sh
Expand Up @@ -94,6 +94,10 @@ mkdir -p attendance/backup/attendance_backups
cp ../backup/backup.sh attendance/backup/backup.sh
chmod +x attendance/backup/backup.sh

mkdir -p attendance/scripts/logs
cp ./scripts/*.sh attendance/scripts
chmod +x attendance/scripts/*.sh

# -r recursive
# -l copy symlinks as symlinks
# -p preserve permissions
Expand All @@ -103,7 +107,8 @@ chmod +x attendance/backup/backup.sh
rsync -rlptvz --progress --delete \
-e 'ssh -i ~/.ssh/id_rsa_win' \
./attendance/ momentu2@momentum4999.com:~/public_html/attendance \
--exclude backup/attendance_backups/
--exclude backup/attendance_backups/ \
--exclude scripts/logs

ssh -i ~/.ssh/id_rsa_win momentu2@momentum4999.com 'bash -l -c "~/public_html/attendance/install.sh"'

Expand Down
30 changes: 30 additions & 0 deletions deploy/scripts/daily.sh
@@ -0,0 +1,30 @@
#!/bin/bash

SCRIPT_DIR=$(dirname $(readlink -f $0))
API_DIR=$(readlink -f ${SCRIPT_DIR}/../attendance-api/)

LOG_DIR=${SCRIPT_DIR}/logs
OUTPUT_FILE=${LOG_DIR}/daily.log

if [ ! -d "${LOG_DIR}" ]; then
mkdir ${LOG_DIR}
fi

# BEGIN REDIRECTED STDOUT, STDERR
{
if [ ! -d "${API_DIR}" ]; then
echo "Error: ${API_DIR} is not a directory"
exit 1
fi

date --rfc-3339=seconds | tr -d '\n'
echo -e "\\t${0}"

cd ${API_DIR}

php artisan meetings:end

echo

} >> ${OUTPUT_FILE} 2>&1

0 comments on commit 09848c3

Please sign in to comment.