#!/bin/bash

if [ $1 = "disk" ]; then
    #sed -i "s/^\*\.\*.*\/.*/\*\.\* \/var\/log\/messages/g" /etc/rsyslog.conf 
    sed -i 's/\(.*\)mychannel\(.*\)messages\(.*\)/\1mychannel,\/var\/log\/messages\3/g' /etc/rsyslog.conf
elif [ $1 = "ram" ]; then
    #sed -i "s/^\*\.\*.*\/.*/\*\.\* \/tmp\/log\/messages/g" /etc/rsyslog.conf
    sed -i 's/\(.*\)mychannel\(.*\)messages\(.*\)/\1mychannel,\/tmp\/log\/messages\3/g' /etc/rsyslog.conf
    
fi

/etc/init.d/rsyslog restart > /dev/null
exit 0
