#!/sbin/runscript

## $Id: tmpfs_rsync 1085 2010-12-10 18:22:06Z afm $
## $URL: file:///var/svn/firmware/rpv311/etc/init.d/tmpfs_rsync $

## Criado por Andre Marra em 01/2011.
## Modificado por Andre Marra em 07/2012.

## Copyright (C) 2011 Reason Tecnologia SA. Todos os direitos reservados.

RSYNC=/usr/bin/rsync
SED=/bin/sed

depend () 
{
 need localmount
 before syslog-ng
 after bootmisc
}

start ()
{
 # Modifica os estados de cada warning para inicio de operacao do equipamento
 ${SED} -e "s/on/off/" /var/foo/var/run/pqfw/warnings > /dev/null 2>&1
 ${SED} -e "1s/off/on/" /var/foo/var/run/pqfw/warnings > /dev/null 2>&1
 ${SED} -e "5s/off/on/" /var/foo/var/run/pqfw/warnings > /dev/null 2>&1
 ${RSYNC} -a /var/foo/var/log/ /var/log > /dev/null 2>&1
 ${RSYNC} -a --filter='exclude *.pid' /var/foo/var/run/ /var/run > /dev/null 2>&1
 ${RSYNC} -a /var/foo/data/log/ /data/log > /dev/null 2>&1
}

stop () 
{
 ${RSYNC} -a /var/log/ /var/foo/var/log > /dev/null 2>&1
 ${RSYNC} -a --filter='exclude *.pid' /var/run/ /var/foo/var/run > /dev/null 2>&1
 ${RSYNC} -a /data/log/ /var/foo/data/log > /dev/null 2>&1
}

## eof $Id: tmpfs_rsync 1085 2010-12-10 18:22:06Z afm $