Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Variaveis
- DATEDIR_APACHE=$(date -d yesterday +%Y/%m/%d)
- DATENAME=$(date -d yesterday +%Y%m%d)
- HOSTS=$( cut -f1 -d' ' server_log2.txt)
- HOSTNAME=$( cut -f2 -d' ' server_log2.txt)
- PORT=$( cut -f3 -d' ' server_log2.txt)
- MAINLOGDIR=$( cut -f4 -d' ' server_log2.txt)
- DIRECTORIES=$(ssh -p ${PORT} ${HOST} "find ${MAILLOGDIR} -type d")
- cat server_log2.txt | while read
- do
- DIRECTORIES=$( ssh ${HOSTS} "find ${MAINLOGDIR} -type d")
- if [ ! -z ${DIRECTORIES} ] ; then
- for TMP in ${DIRECTORIES}
- do
- # Encontrar os arquivos criados ontem
- # Para cada arquivo criado ontem
- # Definir variaveis LOGDIR e LOGFILE
- #find {DIRECTORIES} -type f -mmin -120 -exec
- rsync -va --rsh='ssh -p $PORT' ${HOSTS}:${MAINLOGDIR}/*log var/log/${DATEDIR}
- done
- fi
- #else
- # rsync -vae "ssh -p ${PORT}" ${HOST}:${LOGDIR}/${LOGFILE} /opt/log-collector/${JAILNAME}/${DATEDIR}/{LOGDIR}/${LOGFILE}
- # fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement