You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
637 B

#!/usr/bin/env bash
set -eu
sync
#if ! cat /proc/cmdline | grep -q vdn-emulator; then
if [ ! -e "/overlays/rw" ]; then
echo "Commande réservée à un système VDN." >&2
exit 1
fi
. /etc/vdn/config
e=""
for i in $SAVE_EXCLUDE; do
e="$e --exclude $i"
done
set +u
if [ "$CLEAR_LOG_WHEN_SAVE" = 1 ]; then
find /var/log -type f ! -name "*.gz" -exec truncate -s 0 {} \;
find /var/log -maxdepth 2 -type f -name '*log' -exec truncate -s 0 {} \;
fi
if [ "$DELETE_LOG_GZ = 1" ]; then
find /var/log -type f -name "*.gz" -delete
fi
set -u
cd /overlays/rw/data
tar $e -czpf - .
#umount -a
#sync
#sleep 1
#/usr/sbin/.poweroff