Initial commit
This commit is contained in:
commit
e397b4a8a0
21
backup_git.sh
Normal file
21
backup_git.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
DATE=$(date +%Y%m%d-%Hh%M)
|
||||
LOGFILE=/home/johannes/.var/log/${DATE}-backup.log
|
||||
touch $LOGFILE
|
||||
echo "--------------------------------------------------------------------" >> $LOGFILE
|
||||
for repo in $(find /home/johannes -type d -name '.jr_backup'); do
|
||||
pushd $repo/..
|
||||
git add $repo/../* >> $LOGFILE
|
||||
git commit -m "backup-${DATE}" >> $LOGFILE
|
||||
git push >> $LOGFILE
|
||||
popd
|
||||
echo "\n\n\n" >> $LOGFILE
|
||||
done
|
||||
pushd /etc
|
||||
sudo git add /etc/* >> $LOGFILE
|
||||
sudo git commit -m "backup-${DATE}" >> $LOGFILE
|
||||
sudo chown -R johannes:johannes .git >> $LOGFILE
|
||||
git push >> $LOGFILE
|
||||
popd
|
||||
echo "--------------------------------------------------------------------" >> $LOGFILE
|
||||
9
push_backup_git.sh
Normal file
9
push_backup_git.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#/bin/bash`
|
||||
DATE=$(date +%Y%m%d-%Hh%M)
|
||||
LOGFILE=/home/johannes/.var/log/push-${DATE}-backup.log
|
||||
for d in $(find -type d -name '.jr_backup'); do
|
||||
printf "%s: " $repo >> $LOGFILE
|
||||
git -C ${repo}/.. push origin main >> $LOGFILE 2>&1
|
||||
printf "\n" >> $LOGFILE
|
||||
done
|
||||
git -C /etc push origin main >> $LOGFILE 2>&1
|
||||
9
root_backup_git.sh
Normal file
9
root_backup_git.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
DATE=$(date +%Y%m%d-%Hh%M)
|
||||
LOGFILE=/home/johannes/.var/log/root-${DATE}-backup.log
|
||||
touch $LOGFILE 2>&1
|
||||
pushd /etc
|
||||
sudo git add /etc/* >> $LOGFILE 2>&1
|
||||
sudo git commit -m "backup-${DATE}" >> $LOGFILE 2>&1
|
||||
sudo chown -R johannes:johannes .git >> $LOGFILE 2>&1
|
||||
popd
|
||||
12
user_backup_git.sh
Normal file
12
user_backup_git.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
DATE=$(date +%Y%m%d-%Hh%M)
|
||||
LOGFILE=/home/johannes/.var/log/${DATE}-user-backup.log
|
||||
su johannes -c "touch $LOGFILE 2>&1"
|
||||
echo "--------------------------------------------------------------------" >> $LOGFILE 2>&1
|
||||
for repo in $(find /home/johannes -type d -name '.jr_backup'); do
|
||||
git -C $repo/.. add $repo/../* >> $LOGFILE 2>&1
|
||||
git -C $repo/.. commit -m "backup-${DATE}" >> $LOGFILE 2>&1
|
||||
printf "\n\n\n" >> $LOGFILE 2>&1
|
||||
done
|
||||
echo "--------------------------------------------------------------------" >> $LOGFILE 2>&1
|
||||
Loading…
Reference in New Issue
Block a user