diff --git a/README.md b/README.md index 77c1c50..a53fc31 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ crontab is... (minute) (hour) (day of month) (month) (day of week) -The following is the production crontab. you can directly copy these lines into the cron schedule... +The following is the production crontab for DIA. you can directly copy these lines into the cron schedule... 1) Stop the cron service. sudo service cron stop 2) Copy/Paste daya ... sudo crontab -e and then copy the below lines 3) Restart cron sudo service cron restart @@ -187,3 +187,19 @@ CRON_DIR_IPMONITOR=/opt/MarketData/IPMonitor 0 * * * * cd $CRON_DIR_IPMONITOR ; /opt/MarketData/IPMonitor/ipmonitor IPMONITOR /FORCE:true > /dev/null 2>&1 10,20,30,40,50 * * * * cd $CRON_DIR_IPMONITOR ; /opt/MarketData/IPMonitor/ipmonitor > /dev/null 2>&1 +The following is the production crontab for Adrastea to backup the database every saturday at noon. you can directly copy these lines into the cron schedule... +1) Stop the cron service. sudo service cron stop +2) Copy/Paste daya ... sudo crontab -e and then copy the below lines +3) Restart cron sudo service cron restart +4) Ensure cron is running sudo service cron status +# sudo service cron reload , sudo service cron restart +# cron helper app here -> https://cron.help/#*/5_9-17_*_*_1-5 +# m h dom mon dow command +# sudo service cron reload , sudo service cron restart +# cron helper app here -> https://cron.help/#*/5_9-17_*_*_1-5 +CRON_DIR=/home/pi/ARM64/Scripts +0 12 * * 6 cd $CRON_DIR ; ./dump.sh > /dev/null 2>&1 + + + + diff --git a/Scripts/dump.sh b/Scripts/dump.sh new file mode 100755 index 0000000..f31938c --- /dev/null +++ b/Scripts/dump.sh @@ -0,0 +1,20 @@ +#!/bin/bash +TARGET_FILE=backupdb.sql +TAR_FILE=backupdb.tar.gz +printf "Dumping database\n" + +if test -f "$TARGET_FILE" +then + echo "Removing $TARGET_FILE" + sudo rm "$TARGET_FILE" +fi +if test -f "$TAR_FILE" +then + echo "Removing $TAR_FILE" + sudo rm "$TAR_FILE" +fi +echo "Creating $TARGET_FILE" +#mysqldump --hex-blob --max_allowed_packet=64M --default-character-set=utf8mb4 --databases market_data portfolio_data user_data --user=root --password=dbas --master-data > "$TARGET_FILE" +mysqldump --hex-blob --max_allowed_packet=64M --default-character-set=utf8mb4 --databases market_data portfolio_data user_data --user=root --password=dbas --master-data | pv > "$TARGET_FILE" +echo "Creating $TAR_FILE" +tar -czvf "$TAR_FILE" "$TARGET_FILE"