mirror of
https://github.com/brunofontes/linuxShortcuts.git
synced 2025-04-20 00:37:11 +00:00
Compare commits
No commits in common. "3c0d5be76aa858775a37026828d06667c4d503ed" and "2b36d7c555cd72fcf664a1c4f59d1ecebb9f3e11" have entirely different histories.
3c0d5be76a
...
2b36d7c555
1
Services/after-wakeup.service
Executable file → Normal file
1
Services/after-wakeup.service
Executable file → Normal file
@ -1,7 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Bruno Fontes script after wakeup
|
Description=Bruno Fontes script after wakeup
|
||||||
After=suspend.target
|
After=suspend.target
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
1
Services/backup-contabo.service
Executable file → Normal file
1
Services/backup-contabo.service
Executable file → Normal file
@ -1,6 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Backup contabo daily
|
Description=Backup contabo daily
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh
|
ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Backup joplin weekly
|
Description=Backup joplin weekly
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=bruno
|
User=bruno
|
||||||
|
1
Services/before-sleep.service
Executable file → Normal file
1
Services/before-sleep.service
Executable file → Normal file
@ -1,7 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Bruno Fontes script before sleep
|
Description=Bruno Fontes script before sleep
|
||||||
Before=sleep.target
|
Before=sleep.target
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
0
Services/logErrors@.service
Executable file → Normal file
0
Services/logErrors@.service
Executable file → Normal file
@ -1,6 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Minecraft Informa a Hora Certa
|
Description=Minecraft Informa a Hora Certa
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=bruno
|
User=bruno
|
||||||
|
@ -1,93 +1,57 @@
|
|||||||
if screen -list | grep -q "MncftPublic"; then
|
if ! screen -list | grep -q "Minecraft"; then
|
||||||
publicBackup="true"
|
exit 1
|
||||||
fi
|
|
||||||
if screen -list | grep -q "Minecraft"; then
|
|
||||||
otherBackup="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $publicBackup && -z $otherBackup ]] ; then
|
|
||||||
echo "Entrei"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BACKUPDIR="/home/bruno/Backups/zBackup-Minecraft/backups"
|
BACKUPDIR="/home/bruno/Backups/zBackup-Minecraft/backups"
|
||||||
SERVERDIR="/home/bruno/Apps/Minecraft"
|
SERVERDIR="/home/bruno/Apps/Minecraft"
|
||||||
PUBLICDIR="$SERVERDIR/BedrockServer_Public_19132"
|
|
||||||
SURVIVALDIR="$SERVERDIR/BedrockServer_Survival_19132"
|
SURVIVALDIR="$SERVERDIR/BedrockServer_Survival_19132"
|
||||||
CREATIVEDIR="$SERVERDIR/BedrockServer_Creative_19134"
|
CREATIVEDIR="$SERVERDIR/BedrockServer_Creative_19134"
|
||||||
LogFile="log.txt"
|
LogFile="log.txt"
|
||||||
|
|
||||||
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'
|
||||||
alias runCreative='run at Creative stuff'
|
alias runCreative='run at Creative stuff'
|
||||||
alias runPublic='screen -S MncftPublic -X at Server stuff'
|
|
||||||
alias runAllWorlds='run at "#" stuff'
|
alias runAllWorlds='run at "#" stuff'
|
||||||
|
|
||||||
cd /home/bruno/Apps/Minecraft
|
cd /home/bruno/Apps/Minecraft
|
||||||
|
|
||||||
runAllWorlds "^u"
|
runAllWorlds "^u"
|
||||||
# runAllWorlds "say $(date +%l:%M) - Saving worlds\n"
|
runAllWorlds "say $(date +%l:%M) - Saving worlds\n"
|
||||||
runPublic "say ^usave hold\n"
|
runAllWorlds "save hold\n"
|
||||||
runAllWorlds "^usave hold\n"
|
|
||||||
sleep 2s
|
sleep 2s
|
||||||
|
|
||||||
|
finishedCreative=""
|
||||||
if [[ $publicBackup ]]; then
|
timeout=30
|
||||||
echo Preparing public
|
while [[ $finishedCreative != *"Data saved."* ]]; do
|
||||||
finishedPublic=""
|
if [[ $timeout -lt 1 ]]; then
|
||||||
timeout=30
|
notify-send "Error backuping Creative world"
|
||||||
while [[ $finishedPublic != *"Data saved."* ]]; do
|
exit 1
|
||||||
if [[ $timeout -lt 1 ]]; then
|
fi
|
||||||
notify-send "Error backuping Creative world"
|
(( timeout-- ))
|
||||||
exit 1
|
sleep 1s
|
||||||
fi
|
|
||||||
(( timeout-- ))
|
|
||||||
sleep 1s
|
|
||||||
runPublic "say ^usave query\n"
|
|
||||||
finishedPublic=$(tail -n 4 "$PUBLICDIR/$LogFile")
|
|
||||||
done
|
|
||||||
/bin/tar c "$PUBLICDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/MncftPublic"
|
|
||||||
runPublic "say ^usave resume\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $otherBackup ]]; then
|
|
||||||
echo Preparing others
|
|
||||||
finishedCreative=""
|
|
||||||
timeout=30
|
|
||||||
while [[ $finishedCreative != *"Data saved."* ]]; do
|
|
||||||
if [[ $timeout -lt 1 ]]; then
|
|
||||||
notify-send "Error backuping Creative world"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
(( timeout-- ))
|
|
||||||
sleep 1s
|
|
||||||
runCreative "^u"
|
|
||||||
runCreative "save query\n"
|
|
||||||
finishedCreative=$(tail -n 4 "$CREATIVEDIR/$LogFile")
|
|
||||||
done
|
|
||||||
runCreative "^u"
|
runCreative "^u"
|
||||||
runCreative "save resume\n"
|
runCreative "save query\n"
|
||||||
|
finishedCreative=$(tail -n 4 "$CREATIVEDIR/$LogFile")
|
||||||
|
done
|
||||||
|
|
||||||
timeout=30
|
timeout=30
|
||||||
finishedSurvival=""
|
finishedSurvival=""
|
||||||
while [[ $finishedSurvival != *"Data saved."* ]]; do
|
while [[ $finishedSurvival != *"Data saved."* ]]; do
|
||||||
if [[ $timeout -lt 1 ]]; then
|
if [[ $timeout -lt 1 ]]; then
|
||||||
notify-send "Error backuping Survival world"
|
notify-send "Error backuping Survival world"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
(( timeout-- ))
|
(( timeout-- ))
|
||||||
sleep 1s
|
sleep 1s
|
||||||
runSurvival "^u"
|
|
||||||
runSurvival "save query\n"
|
|
||||||
finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile")
|
|
||||||
done
|
|
||||||
|
|
||||||
/bin/tar c "$SURVIVALDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/Survival"
|
|
||||||
/bin/tar c "$CREATIVEDIR/worlds" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE/Creative"
|
|
||||||
runSurvival "^u"
|
runSurvival "^u"
|
||||||
runSurvival "save resume\n"
|
runSurvival "save query\n"
|
||||||
fi
|
finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile")
|
||||||
|
done
|
||||||
|
|
||||||
|
BACKUPDATE=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||||
|
mkdir "$BACKUPDIR/$BACKUPDATE"
|
||||||
|
/bin/tar c --exclude=behavior_packs/* --exclude=resource_packs/* "$SURVIVALDIR/worlds/Survival" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE-Survival"
|
||||||
|
/bin/tar c --exclude=behavior_packs/* --exclude=resource_packs/* "$CREATIVEDIR/worlds/Creative" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE-Creative"
|
||||||
|
|
||||||
|
runAllWorlds "^u"
|
||||||
|
runAllWorlds "save resume\n"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Properly shutdown Minecraft before PC shutdown
|
Description=Properly shutdown Minecraft before PC shutdown
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
1
Services/roothints.service
Executable file → Normal file
1
Services/roothints.service
Executable file → Normal file
@ -1,7 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Update root hints for unbound
|
Description=Update root hints for unbound
|
||||||
After=network.target
|
After=network.target
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/curl -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache
|
ExecStart=/usr/bin/curl -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache
|
||||||
|
1
Services/testDNS.service
Executable file → Normal file
1
Services/testDNS.service
Executable file → Normal file
@ -2,7 +2,6 @@
|
|||||||
Description=Test and fix DNS update with wrong time
|
Description=Test and fix DNS update with wrong time
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
1
Services/updateRootHints.service
Executable file → Normal file
1
Services/updateRootHints.service
Executable file → Normal file
@ -1,6 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Run update DNS root hints montly
|
Description=Run update DNS root hints montly
|
||||||
OnFailure=logErrors@%n.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
Loading…
Reference in New Issue
Block a user