[arch-general] back up /var/log before shutdown

Arno Gaboury arnaud.gaboury at gmail.com
Wed Jun 20 04:36:17 EDT 2012


Dear all,

My /, /boot and /usr are on a BTRFS  /(except /boot on ext2) on a ssd.
I want to add this line in my fstab to avoid too many writings on my ssd :

*tmpfs       /var/log       tmpfs nodev,nosuid,noexec             0     0*

So each time I reboot, my /var/log will be emptied, which could be a 
problem in case of serious issue on my box. I was then thinking of a way 
to backup this folder before I shutdown. I found this trick in the Arch 
forum:

add this in my */etc/rc.local.shutdown*:

|*echo "Copying LOGs..."

now=`date +"%Y%m%d_%Hh%M"`
mkdir -p /logs_backup/$now
cp -Rp /var/log/* ~/backup/logs_backup/$now/*

My ~ folder is on another HD.

Will this script be enough to do the job?

TY for advising.
|




More information about the arch-general mailing list