refactor: update skeleton and scripts
This commit is contained in:
parent
fad2dcf339
commit
07994c11c5
7 changed files with 18 additions and 24 deletions
27
setup.sh
27
setup.sh
|
@ -19,30 +19,23 @@ fi
|
||||||
|
|
||||||
## MAIN
|
## MAIN
|
||||||
|
|
||||||
if ! [ -d "/neb" ]; then
|
if ! [ -f "/etc/ixvd/version" ]; then
|
||||||
echo "setting up ixvd/neb repo"
|
echo "applying overlay..."
|
||||||
git clone \
|
cp -r skel /
|
||||||
--recurse-submodules \
|
fi
|
||||||
git@git.ixvd.net:ixvd/neb \
|
|
||||||
/neb
|
if ! [ -d "/etc/ixvd/secrets" ]; then
|
||||||
|
echo "setting up ixvd/secrets"
|
||||||
|
git clone git@git.ixvd.net/ixvd/secrets /etc/ixvd/secrets
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -f "/root/.ssh/authorized_keys" ]; then
|
if ! [ -f "/root/.ssh/authorized_keys" ]; then
|
||||||
echo "importing authorized_keys..."
|
echo "importing authorized_keys..."
|
||||||
mkdir -p /root/.ssh
|
mkdir -p /root/.ssh
|
||||||
cp secrets/ssh/authorized_keys /root/.ssh/authorized_keys
|
cp /etc/ixvd/secrets/ssh/authorized_keys /root/.ssh/authorized_keys
|
||||||
else
|
else
|
||||||
if ! grep -q "# IXVD keys" /root/.ssh/authorized_keys; then
|
if ! grep -q "# IXVD keys" /root/.ssh/authorized_keys; then
|
||||||
echo "importing authorized_keys..."
|
echo "importing authorized_keys..."
|
||||||
cat secrets/ssh/authorized_keys >> /root/.ssh/authorized_keys
|
cat /etc/ixvd/secrets/ssh/authorized_keys >> /root/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/cron.d
|
|
||||||
cd common/cron
|
|
||||||
for cronfile in *.crontab; do
|
|
||||||
[ -f "/etc/cron.d/$cronfile" ] && continue
|
|
||||||
echo "installing $cronfile..."
|
|
||||||
cp $cronfile /etc/cron.d/$cronfile
|
|
||||||
done
|
|
||||||
cd $ORIGIN_PWD
|
|
|
@ -1,10 +1,10 @@
|
||||||
# /etc/cron.d/restic.crontab
|
# /etc/cron.d/restic.crontab
|
||||||
|
|
||||||
# every 4 hours create a backup
|
# every 4 hours create a backup
|
||||||
0 */4 * * * root /neb/common/restic/backup.sh
|
0 */4 * * * root /opt/scripts/restic/backup.sh
|
||||||
|
|
||||||
# every day at 2 in the morning, forget old backups
|
# every day at 2 in the morning, forget old backups
|
||||||
0 2 * * * root /neb/common/restic/forget.sh
|
0 2 * * * root /opt/scripts/restic/forget.sh
|
||||||
|
|
||||||
# every 1st of the month at 2 in the morning, prune
|
# every 1st of the month at 2 in the morning, prune
|
||||||
50 2 1 * * root /neb/common/restic/prune.sh
|
50 2 1 * * root /opt/scripts/restic/prune.sh
|
1
skel/etc/ixvd/version
Normal file
1
skel/etc/ixvd/version
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ntfy() {
|
ntfy() {
|
||||||
sh /opt/ixvd/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
|
sh /opt/scripts/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
ntfy -m "performing backup..."
|
ntfy -m "performing backup..."
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ntfy() {
|
ntfy() {
|
||||||
sh /opt/ixvd/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
|
sh /opt/scripts/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
ntfy -m "forgetting old backups..."
|
ntfy -m "forgetting old backups..."
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ntfy() {
|
ntfy() {
|
||||||
sh /opt/ixvd/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
|
sh /opt/scripts/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
ntfy -m "pruning old backups..."
|
ntfy -m "pruning old backups..."
|
Loading…
Reference in a new issue