%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /backups/router/usr/local/etc/rc.syshook.d/backup/
Upload File :
Create Path :
Current File : //backups/router/usr/local/etc/rc.syshook.d/backup/20-netflow

#!/bin/sh

BACKUPDIR="/var/netflow"
BACKUPFILE="/conf/netflow.tgz"
BACKUPOFF="<netflowbackup>-1</netflowbackup>"

# find out if the service is running and stop/start it only if needed
RCSCRIPT="/usr/local/etc/rc.d/flowd_aggregate"
if ! ${RCSCRIPT} status > /dev/null; then
	RCSCRIPT="true"
fi

if [ "$(grep -c "${BACKUPOFF}" /conf/config.xml)" != "0" ]; then
	rm -f ${BACKUPFILE}
elif [ "${1}" = "restore" ]; then
	if [ -f "${BACKUPFILE}" ]; then
		${RCSCRIPT} stop
		tar -C / -xzpf "${BACKUPFILE}"
		${RCSCRIPT} start
	fi
else
	if [ -d "${BACKUPDIR}" ]; then
		${RCSCRIPT} stop
		tar -C / -czf "${BACKUPFILE}" ."${BACKUPDIR}"
		${RCSCRIPT} start
	fi
fi

Zerion Mini Shell 1.0