[arch-general] [PATCHES] About /var/run/ and /var/lock/ checks in daemons

Nicolas Bigaouette nbigaouette at gmail.com
Thu Feb 12 09:34:02 EST 2009


I also have these as tmpfs:
/var/cache/songbird
/var/cache/firefox
/var/lock
/var/log
/var/run
/var/tmp
/tmp
I created a simple daemon to sync the files. I don't need patching: just add
it to the daemon array. I don't care about all except for logs. Here is the
small daemon:
#!/bin/bash

now=`date +"%Y%m%d_%Hh%m"`

case "$1" in
    stop)
        mkdir -p /logs_backup/$now
        cp -Rp /var/log/* /logs_backup/$now/
    ;;
    start)
    ;;
    *)
        echo 'Usage: /etc/rc.d/logsbackup stop'
        exit 1
   ;;
esac

It copies the log to /logs_backup/ with a new directory containing the date.
Because of this logs don't get overwritten. You need to check them manually
though. You don't want log to take all ssd space :)


2009/2/12 Jan Spakula <jan.spakula at gmx.com>

> Excerpts from Jan Spakula's message of Thu Feb 12 09:22:00 +0100 2009:
> > Excerpts from Jan de Groot's message of Thu Feb 12 08:59:41 +0100 2009:
> > > On Thu, 2009-02-12 at 05:51 -0200, Gerardo Exequiel Pozzi wrote:
> > > > I interested to make Arch Linux suitable for use with a /var/run and
> > > > /var/lock that are mounted as tmpfs. But this also helps, in the case
> > > > that not mounted as tmpfs, to make more simple "purge function" for
> > > > these directories at rc.sysinit step.
> > > >
> > > > In my case this is "just for fun!", but other users can be benefited
> by
> > > > this, for example "netbook users".
> > > If this requires patching so many packages, and given the fact
> > > that /var/run on tmpfs is not default in archlinux, maybe you should
> try
> > > building /var/run from an initial directory or something like that.
> This
> > > is also what I use for my OpenBSD router which runs from compactflash
> > > and has /var mounted on ramdisk.
> >
> > I have a setup on my netbook where the whole /var is mounted as tmpfs and
> > rsynced from and to real directory (/var-sync in my case) on
> boot/shutdown.
> > Patches to rc.sysinit and rc.shutdown follow. [Note that whenever you
> update
> > initscripts, you need to patch at least rc.shutdown before rebooting :)]
>
> Well apparently attachments are scrubbed, so here you go
> http://rafb.net/p/ePKlct55.html
> http://rafb.net/p/yDQSPc95.html
>
> Advantages are mainly on netbooks, which have limited number of writes to
> their ssd drives, this eliminated a big source of uncontrolled writes.
>


More information about the arch-general mailing list