Comment 2 for bug 290127

Revision history for this message
Russell Phillips (ignissport) wrote :

I have a similar setup, except I have an SSD so I've got /var/log mounted on tmpfs. The directory needs to start afresh on each boot. This is a common trick for people who need to reduce the write count on their EeePC or Aspire One.

Here's a method which will touch the required logfiles (including the 'news' directory), and also create the directory for the logfile if it does not already exist. This allows the entire log directory to be rebuilt on boot, regardless of what paths are specified in /etc/syslog.conf:

fix_log_ownership()
{
        for l in `syslogd-listfiles -a --news`
        do
                # Create directory for logfile if required
                ldir=$(echo ${l} | sed 's/[^\/]*$//g')
                if [ ! -e $ldir ] ; then
                        mkdir -p $ldir
                fi
                # Touch logfile and chown
                touch $l && chown ${USER}:adm $l
        done
}