Files moved from scripts.

This commit is contained in:
2021-10-24 20:39:49 +01:00
parent ffbdf4140d
commit ecd1ef42b6
35 changed files with 757 additions and 2 deletions

67
bin/arch/backup.git.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
CD=cd
DATE=/bin/date
TAR=/bin/tar
BZIP2=/bin/bzip2
GIT=/usr/bin/git
GPG=/usr/bin/gpg
PASS=/home/vahagn/.gnupg/backup-passphrase
SRC=/home/vahagn/git
KEEP=5
BACKUP_DIR=/home/vahagn/gdrive/backup
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
LOG=/mnt/hdd/backup/backup.git.$TIMESTAMP.log
BACKUP=$BACKUP_DIR/git.$TIMESTAMP.tar.bz2.gpg
SIGNATURE=$BACKUP_DIR/git.$TIMESTAMP.tar.bz2.sig
#
# debug
#
#LOG=/home/vahagn/devel/scripts/backup/log.log
#BACKUP=/home/vahagn/devel/scripts/backup/git.tar.bz2.gpg
#SRC=/home/vahagn/git/scripts.git
#
# Header
#
echo Starting $LOG | tee -a $LOG
echo start `$DATE` | tee -a $LOG
#
# Sync with BitBucket upstream repos.
#
$CD $SRC/scripts.git
$GIT fetch
$CD $SRC/test.git
$GIT fetch
#
# cd to git directory and then bzip2 all content and crypt it.
#
$CD $SRC
($TAR -cvp . | $BZIP2 -c | $GPG -c --passphrase-file $PASS --output $BACKUP --batch --quiet ) 2>&1| tee -a $LOG
#
# Remove old files
#
$CD $BACKUP_DIR
i=0
for FILE in `ls -t git.*.tar.bz2.gpg`; do
if [ $i -ge $KEEP ]; then
echo "$FILE is removed to meet keep number of backups $KEEP." | tee -a $LOG
rm $FILE 2>&1| tee -a $LOG
fi;
i=$(($i+1))
done
i=0
for FILE in `ls -t git.*.tar.bz2.sig`; do
if [ $i -ge $KEEP ]; then
echo "$FILE is removed to meet keep number of backups $KEEP." | tee -a $LOG
rm $FILE 2>&1| tee -a $LOG
fi;
i=$(($i+1))
done
#
# Footer
#
echo end `$DATE` | tee -a $LOG

View File

@@ -0,0 +1,12 @@
#!/bin/bash
DATE=/bin/date
SYNC="/usr/bin/rsync -auAX --delete"
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
LOG=/mnt/hdd/backup/backup.mybook.vahagn.$TIMESTAMP.log
echo Starting $LOG | tee -a $LOG
echo start `$DATE` | tee -a $LOG
$SYNC /mnt/mybook/vahagn /mnt/hdd/backup | tee -a $LOG
echo end `$DATE` | tee -a $LOG

51
bin/arch/backup.root.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
DATE=/bin/date
RSYNC=/usr/bin/rsync
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
LOGFILE=/mnt/hdd/backup/log/backup.mybook.public.$TIMESTAMP.log
LOG="/usr/bin/tee -a $LOGFILE"
function term() {
echo "Terminating." | $LOG
exit 1
}
trap term INT
function backup() {
ORIG_DIR=$1
MIRROR_DIR=$2
echo "Sync $ORIG_DIR to $MIRROR_DIR"
$RSYNC -aXv --delete --force $ORIG_DIR $MIRROR_DIR | $LOG
}
function backupwd() {
ORIG_DIR=$1
MIRROR_DIR=192.168.0.6:/DataVolume/$2
backup $ORIG_DIR $MIRROR_DIR
}
#
# Log Header
#
echo Starting $LOGFILE | $LOG
echo start `$DATE` | $LOG
#
# Sync folders
#
backupwd "/srv/gitlab/" "backup/gitlab"
backupwd "/srv/nextcloud/" "backup/nextcloud"
backupwd "/mnt/hdd/public/_captured_MY_VIDEO/" "public/_captured_MY_VIDEO"
backupwd "/mnt/hdd/public/pix/" "public/pix"
backupwd "/mnt/hdd/public/music/" "public/music"
backupwd "/mnt/hdd/public/books/" "public/books"
backupwd "/mnt/hdd/vahagn/" "backup/vahagn"
backup "/srv/gitlab" "/mnt/hdd/backup/gitlab"
backup "/srv/nextcloud" "/mnt/hdd/backup/nextcloud"
#
# Log Footer
#
echo end `$DATE` | $LOG

102
bin/backup.hdd.sh Executable file
View File

@@ -0,0 +1,102 @@
#!/bin/bash
#set -x
DATE=/bin/date
RSYNC=/usr/bin/rsync
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
LOGFILE=/mnt/hdd/backup/log/backup.$TIMESTAMP.log
LOG="/usr/bin/tee -a $LOGFILE"
function term() {
echo "Terminating." | $LOG
exit 1
}
trap term INT
function backup() {
ORIG_DIR=$1
MIRROR_DIR=$2
shift 2
echo ""
echo "Sync $ORIG_DIR to $MIRROR_DIR"
echo "========================================================"
# Use --progress if interactive.
$RSYNC -aAXv --delete --force "$@" $ORIG_DIR $MIRROR_DIR 2>&1 | $LOG
if [ $? -ne 0 ]; then
echo "There were errors while backing up $ORIG_DIR"
fi
echo ""
}
function backuphdd() {
HDD_ORIG=/mnt/hdd
HDD_MIRROR=/mnt/hdd2
ORIG_DIR=$HDD_ORIG/$1
MIRROR_DIR=$HDD_MIRROR/$(dirname $1)
backup $ORIG_DIR $MIRROR_DIR
}
function backupwd() {
ORIG_DIR=$1
MIRROR_DIR=192.168.0.6:/DataVolume/$2
backup $ORIG_DIR $MIRROR_DIR
}
function backuplusntag() {
ORIG_DIR="vahagn@192.168.0.3:$1"
MIRROR_DIR=$2
backup $ORIG_DIR $MIRROR_DIR -e "ssh -i /home/vahagn/.ssh/id_rsa"
}
function backupyerevak() {
ORIG_DIR="vahagn@yerevak.vostan.org:$1"
MIRROR_DIR=$2
backup $ORIG_DIR $MIRROR_DIR -e "ssh -i /home/vahagn/.ssh/id_rsa -p 24"
}
#
# Log Header
#
echo Starting $LOGFILE | $LOG
echo start `$DATE` | $LOG
#
# Sync folders
#
backup "/srv/nextcloud" "/mnt/hdd/backup/docker"
backup "/var/lib/docker/volumes" "/mnt/hdd/backup/docker"
backup "/src/gerbera/music" "/mnt/hdd/public"
#backup "/srv/gitlab" "/mnt/hdd/backup/gitlab"
#backup "/srv/git" "/mnt/hdd/backup/git"
#
# Backup Lusntag
#
backuplusntag "/home/vahagn/msdos" "/mnt/hdd/backup"
backuplusntag "/home/vahagn/devel" "/mnt/hdd/backup/lusntag"
backuplusntag "/var/www" "/mnt/hdd/backup/lusntag"
backuplusntag "/etc/nginx" "/mnt/hdd/backup/lusntag/etc"
#
# Backup Yerevak
#
backupyerevak "/home/vahagn/devel" "/mnt/hdd/backup/yerevak"
#
# Backup hdd1 to hdd2
#
backuphdd "backup"
backuphdd "vahagn"
for i in $(ls /mnt/hdd/public); do
if [ $i != "movies" ]; then
backuphdd "public/$i"
fi
done
#
# Log Footer
#
echo end `$DATE` | $LOG

7
bin/deluge-tunnel.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
ssh -N \
-D *:1080 \
-L *:58846:127.0.0.1:58846 \
-L *:8112:127.0.0.1:8112 \
yerevak

8
bin/docker-calibre.sh Executable file
View File

@@ -0,0 +1,8 @@
sudo docker create \
--name=calibre --restart=always \
-v /srv/calibre/books:/books \
-v /srv/calibre/config:/calibre-web/config \
-v /etc/localtime:/etc/localtime:ro \
-e PGID=33 -e PUID=33 -p 8095:8083 \
technosoft2000/calibre-web

13
bin/docker-gerbera.sh Executable file
View File

@@ -0,0 +1,13 @@
docker run \
-d \
--net=host \
--name gerbera \
--hostname gerbera \
--restart always \
--volume /srv/gerbera/config:/root/.config \
--volume /srv/gerbera/music:/mnt/music \
--volume /srv/gerbera/video:/mnt/video \
--volume /mnt/hdd2/public/movies:/mnt/hdd_video \
--volume /mnt/hdd/public/music:/mnt/hdd_music \
gerbera/gerbera

12
bin/docker-gitlab.sh Executable file
View File

@@ -0,0 +1,12 @@
sudo docker run --detach \
--name gitlab \
--hostname gitlab \
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.vostan.org/'; gitlab_rails['lfs_enabled'] = true; gitlab_rails['gitlab_signin_enabled'] = false;" \
--publish 8443:443 \
--publish 8080:80 \
--publish 8022:22 \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

7
bin/docker-nextcloud.sh Executable file
View File

@@ -0,0 +1,7 @@
sudo docker run \
--name nextcloud \
-d \
--publish 8090:80 \
--restart always \
--volume /srv/nextcloud:/var/www/html \
nextcloud

1
bin/lsync.sh Executable file
View File

@@ -0,0 +1 @@
rsync -av --progress --inplace --append-verify --remove-source-files -e "ssh -p 24" /mnt/ssd/deluge/done/$1 lusntag.vostan.org:/mnt/home/vahagn/tmp/tmp

BIN
bin/lusntag.socks5.bat Normal file

Binary file not shown.

BIN
bin/lusntag.socks5.ps1 Normal file

Binary file not shown.

BIN
bin/lusntag.socks5.sh Normal file

Binary file not shown.

3
bin/rtorrent.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
sudo ip netns exec soghancq sudo -u vahagn rtorrent -o http_capath=/etc/ssl/certs

3
bin/socks5-hrat.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
ssh -D 192.168.0.4:1085 127.0.0.1 -N

3
bin/socks5-yerevak.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
ssh -N -D 192.168.0.4:1080 yerevak

1
bin/suspend.sh Executable file
View File

@@ -0,0 +1 @@
sudo systemctl suspend

16
bin/upload.ready.deluge.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -x
if [ "$1" != "no-progress" ]; then
PROG=--progress
else
shift
fi
if [ ! -z "$*" ]; then
for i in "$@"; do
/usr/bin/rsync -av --inplace --progress --append-verify "/mnt/ssd/deluge/done/$i" "hrat:tmp/tmp/done/"
done
else
/usr/bin/rsync -av --inplace --append-verify $PROG /mnt/ssd/deluge/done hrat:tmp/tmp
fi

BIN
bin/yerevak.socks5.ps1 Normal file

Binary file not shown.

1
bin/yerevak_download.sh Executable file
View File

@@ -0,0 +1 @@
rsync -av --progress -e "ssh -p 24" yerevak.vostan.org:/mnt/ssd/deluge/done/$1 $2