Update Section_05/cron.sh, Section_05/backup.sh
This commit is contained in:
parent
9aff32ff83
commit
144b41bb1f
15
Section_05/backup.sh
Normal file
15
Section_05/backup.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
CODE_PATH="/home/edgeking810/tmpNodeApp"
|
||||
BACKUP_PATH="/home/edgeking810/backups"
|
||||
|
||||
mkdir -p ${BACKUP_PATH}
|
||||
|
||||
BACKUP_NAME="tmp-node-app-$(date '+%Y-%m-%d_%H-%M-%S').tar.gz"
|
||||
tar -zcvf ${BACKUP_PATH}/${BACKUP_NAME} ${CODE_PATH}
|
||||
|
||||
# Cleanup backups older than 1 month
|
||||
find ${BACKUP_PATH} -name "*.tar.gz" -type f -mtime +30 -delete
|
||||
|
||||
echo "Backup Succeeded: ${BACKUP_PATH}/${BACKUP_NAME}"
|
||||
echo "----------------------------------------------------------------------"
|
8
Section_05/cron.sh
Normal file
8
Section_05/cron.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo apt install cron -y
|
||||
crontab -l
|
||||
|
||||
EDITOR=nano crontab -e
|
||||
# m h dom mon dow command
|
||||
*/10 * * * * bash /home/edgeking810/backup.sh | tee -a /tmp/backup-logs.txt
|
Loading…
x
Reference in New Issue
Block a user