Add a service sync script
This commit is contained in:
parent
5400171298
commit
06c27447fc
|
@ -1 +1,8 @@
|
|||
These are docker-compose stacks I run on various servers.
|
||||
|
||||
My [homelab](homelab/) now uses podman, invoked by runit.
|
||||
I did this for two reasons:
|
||||
|
||||
1. My homelab now runs from a RAM disk,
|
||||
and podman takes half as much space as docker.
|
||||
2. docker swarm had some CPU overhead that podman doesn't have.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Periodically syncs the live system into my git repository.
|
||||
|
||||
In case anybody is ever curious about how this works.
|
|
@ -0,0 +1 @@
|
|||
s16384
|
|
@ -0,0 +1,3 @@
|
|||
#! /bin/sh
|
||||
|
||||
svlogd -tt .
|
|
@ -0,0 +1,28 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
exec 2>&1
|
||||
|
||||
echo "=== Copying newer files"
|
||||
cd /etc/service
|
||||
find . \
|
||||
! -path './*/supervise*' \
|
||||
! -path './*/log/lock' \
|
||||
! -path './*/log/current' \
|
||||
! -path './*/log/@*' \
|
||||
| cpio -R neale -m -p /home/neale/src/stacks/homelab
|
||||
|
||||
|
||||
echo "=== Removing deleted files"
|
||||
cd /home/neale/src/stacks/homelab
|
||||
find */ \
|
||||
| while read fn; do
|
||||
if ! [ -e /etc/service/"$fn" ]; then
|
||||
echo " - $fn"
|
||||
rm -rf "$fn"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo "=== Waiting..."
|
||||
sleep 4h
|
|
@ -1,11 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
service=/host/etc/service
|
||||
if ! [ -d $service ]; then
|
||||
echo "=== $service is not a directory" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rsync -vaxp --delete \
|
||||
--exclude=supervise/ \
|
||||
$service/* .
|
Loading…
Reference in New Issue