Re: back up /var/log before shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 06/20/2012 11:03 AM, Gaetan Bisson wrote:
[2012-06-20 10:36:17 +0200] Arno Gaboury:
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?
Why are you inflicting such a complicated setup on yourself if you
cannot understand what those three little lines of shell do? That seems
to me like a completely backward way of taking the learning curve...

Also, please create new threads instead of hijacking random ones.

Cheers.

After hours of reading, here is the correct script to add in my rc.shutdown.local. I know this method will NOT work in case of system crash, but it is OK for me as I understand what i am doing and it is simple.

*echo -n "Copying /var/log ..."
cd /home/gabx/backup
tar -zcf  "./`date +'%d-%b-%y.tgz'`" /var/log

echo " done."*

I think it is much more simple as the one I mentioned earlier, as Gaetan pointed out.

Cheers.



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux