Compare commits

..

7 Commits

Author SHA1 Message Date
3347cb35e6
feat(systemd): add shortcut to add new service
The script removes an old version, copy the new service to the correct
folder, run a daemon-reload and get a status about it.
2021-03-26 23:32:49 -03:00
b9ddb223e4
fix(Minecraft-hour.sh): do not create unecessary folder inside backup 2021-03-26 23:24:05 -03:00
c45afbc817
chore(tmuxPMovase): improve tmux organization/sizes 2021-03-26 21:19:36 -03:00
f2095563b3
feat(MinecraftBackup): now using Borg instead of zBackup 2021-03-26 21:18:30 -03:00
b8495afbba
fix(MinecraftBackup): exiting with the correct status
It is expected to do not have a running instance so it should exit nicely.
2021-03-26 20:52:56 -03:00
d1ec197dc4
fix(Backup): do not create unecessary file anymore 2021-03-26 20:43:52 -03:00
9b3515d121
fix(Backup): folder name with space can be backed up
Backup function were not working with folders that had space on it.
Fixed now including double quotes with the parameter inside the
function.
2021-03-26 20:41:19 -03:00
4 changed files with 25 additions and 19 deletions

View File

@ -4,7 +4,7 @@ function backup () {
#--stats = show stats at end #--stats = show stats at end
#--progress = show each file being processed #--progress = show each file being processed
nice -n 19 borg create --compression auto,zstd,9 --exclude-from=./exclude $* nice -n 19 borg create --compression auto,zstd,9 --exclude-from=./exclude $1 "$2"
} }
function backupNoCompression () { function backupNoCompression () {
@ -13,7 +13,7 @@ function backupNoCompression () {
#--stats = show stats at end #--stats = show stats at end
#--progress = show each file being processed #--progress = show each file being processed
nice -n 19 borg create --compression none --exclude-from=./exclude $* nice -n 19 borg create --compression none --exclude-from=./exclude $1 "$2"
} }
function checkBackup() { function checkBackup() {
@ -110,14 +110,13 @@ backupNoCompression "$HDPath/Videos::$YEARMONTH" "/run/media/bruno/Multimedia/Vi
checkBackup "$HDPath/Videos/" checkBackup "$HDPath/Videos/"
echo -e "\e[97m`date +%r` - Copying Virtual Machines folder (7/7)...\e[39m" echo -e "\e[97m`date +%r` - Copying Virtual Machines folder (7/7)...\e[39m"
backup "$HDPath/VirtualMachines::$YEARMONTH" "/run/media/bruno/Multimedia/Virtual\ Machines" || echo "" backup "$HDPath/VirtualMachines::$YEARMONTH-2" "/run/media/bruno/Multimedia/Virtual Machines" || echo ""
checkBackup "$HDPath/VirtualMachines/" checkBackup "$HDPath/VirtualMachines/"
# Show result # Show result
echo -e "\e[97m`date +%r` - Backup finished. Please, verify your log files.\e[39m" echo -e "\e[97m`date +%r` - Backup finished. Please, verify your log files.\e[39m"
echo "$ActiveDisk" > .lastDisk echo "$ActiveDisk" > .lastDisk
echo "$ActiveBackupSet" > ".lastBackupSetDisk_$lastDisk"
kdialog --title "Backup Complete" --msgbox "Backup finished successfully" kdialog --title "Backup Complete" --msgbox "Backup finished successfully"
echo echo

View File

@ -0,0 +1,4 @@
doas rm /etc/systemd/system/$1
doas cp -f $1 /etc/systemd/system/
doas systemctl daemon-reload
doas systemctl status $1

View File

@ -6,11 +6,11 @@ if screen -list | grep -q "Minecraft"; then
fi fi
if [[ -z $publicBackup && -z $otherBackup ]] ; then if [[ -z $publicBackup && -z $otherBackup ]] ; then
echo "Entrei" echo "Minecraft is not running. Exiting..."
exit 1 exit 0
fi fi
BACKUPDIR="/home/bruno/Backups/zBackup-Minecraft/backups" BACKUPDIR="/home/bruno/Backups/Minecraft-borg"
SERVERDIR="/home/bruno/Apps/Minecraft" SERVERDIR="/home/bruno/Apps/Minecraft"
PUBLICDIR="$SERVERDIR/BedrockServer_Public_19132" PUBLICDIR="$SERVERDIR/BedrockServer_Public_19132"
SURVIVALDIR="$SERVERDIR/BedrockServer_Survival_19132" SURVIVALDIR="$SERVERDIR/BedrockServer_Survival_19132"
@ -18,7 +18,6 @@ CREATIVEDIR="$SERVERDIR/BedrockServer_Creative_19134"
LogFile="log.txt" LogFile="log.txt"
BACKUPDATE=$(date +"%Y-%m-%d_%H-%M-%S") BACKUPDATE=$(date +"%Y-%m-%d_%H-%M-%S")
mkdir "$BACKUPDIR/$BACKUPDATE"
alias run='screen -S Minecraft -X' alias run='screen -S Minecraft -X'
alias runSurvival='run at Survival stuff' alias runSurvival='run at Survival stuff'
@ -49,7 +48,7 @@ if [[ $publicBackup ]]; then
runPublic "say ^usave query\n" runPublic "say ^usave query\n"
finishedPublic=$(tail -n 4 "$PUBLICDIR/$LogFile") finishedPublic=$(tail -n 4 "$PUBLICDIR/$LogFile")
done done
/bin/tar c "$PUBLICDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/MncftPublic" borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE-MncftPublic" "$PUBLICDIR"
runPublic "say ^usave resume\n" runPublic "say ^usave resume\n"
fi fi
@ -85,9 +84,9 @@ if [[ $otherBackup ]]; then
finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile") finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile")
done done
/bin/tar c "$SURVIVALDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/Survival" borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE-MncftSurvival" "$SURVIVALDIR"
/bin/tar c "$CREATIVEDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/Creative" borg create --stats --compression auto,zstd,9 "$BACKUPDIR::$BACKUPDATE-MncftCreative" "$CREATIVEDIR"
runSurvival "^u" runSurvival "^u"
runSurvival "save resume\n" runSurvival "save resume\n"
fi fi
borg prune --keep-within=3d --keep-hourly=96 --keep-weekly=8 --keep-monthly=6 "$BACKUPDIR"

View File

@ -15,20 +15,24 @@ tmux splitw -h -t pmovase:0.1
terminator -T PMova-se -b --geometry=627x927 -x tmux a -t pmovase & terminator -T PMova-se -b --geometry=627x927 -x tmux a -t pmovase &
tmux resize-pane -t pmovase:0.0 -U 30 tmux resize-pane -t pmovase:0.0 -U 35
tmux resize-pane -t pmovase:0.1 -U 15 tmux resize-pane -t pmovase:0.1 -U 10
tmux resize-pane -t pmovase:0.4 -U 10 tmux resize-pane -t pmovase:0.4 -U 10
tmux send -t pmovase:0.0 $'npm run vagrant; npm run watch\n' tmux send -t pmovase:0.0 $'npm run vagrant; npm run watch\n'
tmux send -t pmovase:0.2 $'clear; Waiting for vagrant to start...\n' tmux send -t pmovase:0.2 $'clear; echo Waiting for vagrant to start...\n'
while [[ -z $(ping projetomovase.test -c 1 | grep "time=") ]] ; do while [[ -z $(ping projetomovase.test -c 1 | grep "time=") ]] ; do
sleep 1 sleep 5
done done
sleep 10
tmux send -t pmovase:0.1 $'npm run cypress:open\n'
tmux send -t pmovase:0.1 $'npm run test-watch\n' tmux send -t pmovase:0.1 $'npm run test-watch\n'
tmux send -t pmovase:0.2 $'^u' tmux send -t pmovase:0.2 $'^u'
tmux send -t pmovase:0.2 $'phpunit-watcher watch\n' tmux send -t pmovase:0.2 $'npm run test-php-watch\n'
tmux send -t pmovase:0.3 $'ssh homestead -t \"cd code;alias clear='clear; figlet Vagrant';clear;bash --login\"\n' tmux send -t pmovase:0.3 $'npm run ssh\n'
tmux send -t pmovase:0.4 $'alias clear='clear;figlet PMova-se';clear\n' tmux send -t pmovase:0.4 $'alias clear=\'clear;figlet PMova-se\';clear\n'
/bin/vscodium &
/home/bruno/Apps/firefox/firefox-bin &