added some files
This commit is contained in:
83
root/scripts/aos-npbackup-sync.sh
Executable file
83
root/scripts/aos-npbackup-sync.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
# aos-npbackup-sync.sh
|
||||
# Backup AoS.Health instance ProxMox Dump Files to remote Host
|
||||
#
|
||||
#
|
||||
# sync backups to remote server
|
||||
STARTTIME="`date '+%d.%m.%y %H:%M'`"
|
||||
START=`date +%s`
|
||||
|
||||
LOGFILE=/var/log/aos-npbackup-sync.log
|
||||
touch $LOGFILE
|
||||
|
||||
# We copied an rsync binary to the remote site as it was not installed by default by NITC.
|
||||
EXTRAARGS='--rsync-path=~/bin/rsync'
|
||||
|
||||
# See /etc/hosts file for actual IP address being used.
|
||||
REMOTEUSER=nphl-antimicrobial-resvm
|
||||
REMOTEHOST=np-backup.nitc
|
||||
|
||||
# Use the near-line backups at /aos-backups because the remote server is only 500GB of space.
|
||||
# an /aos-backups is also limited to this same approximate sizing.
|
||||
SRCDIR=/aos-backups
|
||||
DESTDIR=/home/nphl-antimicrobial-resvm
|
||||
|
||||
## ---------
|
||||
STARTTIME="`date '+%d.%m.%y %H:%M'`"
|
||||
START=`date +%s`
|
||||
THISLOGHEAD="______________________________________\n\
|
||||
|\n\
|
||||
| Script: $0\n\
|
||||
| Hostname: `hostname`\n\
|
||||
| Started: $STARTTIME\n"
|
||||
LOGCONTENT="`head -n 2000 $LOGFILE`"
|
||||
THISLOG=""
|
||||
SUMMARY=""
|
||||
|
||||
|
||||
backup () {
|
||||
local FSTARTTIME="`date '+%H:%M'`"
|
||||
local FSTART=`date +%s`
|
||||
printf "$THISLOGHEAD|\n\n\
|
||||
---------------------------------------\n\
|
||||
| Summary:\n\
|
||||
---------------------------------------\n\
|
||||
$SUMMARY\n\
|
||||
`date '+%H:%M'`-now: $1 -> $2\n\n\
|
||||
---------------------------------------\n\
|
||||
| Details:\
|
||||
\n---------------------------------------\n\
|
||||
$THISLOG\n$LOGCONTENT" > $LOGFILE
|
||||
THISLOG="$THISLOG\n`date '+%d.%m.%y %H:%M'` | $1 \n->$2\n---------------------------------------\n`\
|
||||
rsync -e ssh -av --delete $EXTRAARGS $1 $REMOTEUSER@$REMOTEHOST:$DESTDIR/$2 --stats | \
|
||||
sed '0,/^$/d'`\nfinished: `date '+%d.%m.%y %H:%M'` \n---------------------------------------\n\n"
|
||||
printf "$THISLOGHEAD\n$THISLOG\n$LOGCONTENT" > $LOGFILE
|
||||
local FSECONDS="$((`date +%s`-$FSTART))"
|
||||
SUMMARY="$SUMMARY \n$FSTARTTIME-`date '+%H:%M'` (`date -d@$FSECONDS -u +%H:%M:%S`): $1 -> $2"
|
||||
}
|
||||
|
||||
|
||||
### THIS CALLS THE ACTUAL BACKUP FUNCTION
|
||||
backup $SRCDIR AoS.Health/
|
||||
|
||||
#Finish Script: Runtime-Information and Final-Summary:
|
||||
SECONDS="$((`date +%s`-$START))"
|
||||
printf "$THISLOGHEAD\
|
||||
| Finished: `date '+%d.%m.%y %H:%M'`\n\
|
||||
| Runtime: `date -d@$SECONDS -u +%H:%M:%S`\n|\n\n\
|
||||
---------------------------------------\n\
|
||||
| Summary:\n\
|
||||
---------------------------------------\n\
|
||||
$SUMMARY\n\n\
|
||||
---------------------------------------\n\
|
||||
| Details:\n\
|
||||
---------------------------------------\n\
|
||||
$THISLOG\n\
|
||||
|______________________________________\n\
|
||||
$LOGCONTENT" > $LOGFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
11
root/scripts/hairpinning.sh
Executable file
11
root/scripts/hairpinning.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#/bin/sh
|
||||
|
||||
# https://unix.stackexchange.com/a/81699/37512
|
||||
wanip=`dig @resolver4.opendns.com myip.opendns.com +short`
|
||||
wanip4=`dig @resolver4.opendns.com myip.opendns.com +short -4`
|
||||
wanip6=`dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6`
|
||||
|
||||
echo "wanip.....: $wanip"
|
||||
echo "wanIPV4...: $wanip4"
|
||||
echo "wanIPV6...: $wanip6"
|
||||
|
||||
13
root/scripts/make-tunnel.sh
Executable file
13
root/scripts/make-tunnel.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
autossh \
|
||||
-M 21234 \
|
||||
-o "ServerAliveInterval 30" \
|
||||
-o "ServerAliveCountMax 3" \
|
||||
-R 6000:localhost:22 \
|
||||
-f \
|
||||
root@194.182.191.115 \
|
||||
sleep 31536000
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user