Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # create a backup of CAPLxxx file from many machines / cria um backup do arquivo CAPLxxx de várias máquinas
- # VERSAO NOVA / NEW VERSION
- IP_SERVER=192.168.0.112
- PASTA_BKP=bkppdvsloja1
- USUARIO=Administrador
- SENHA=senha
- DATA=`date +%d%m`
- # lista com os ips dos pdvs
- LISTA="41 42 43 44 45 46 47 48"
- for x in $LISTA; do
- # pega o numero da ecf / take the ECf number
- ssh -x 192.168.0.$x "grep NROCPU /posnet/pdv.conf | awk '{print$3}' | cut -d'\"' -f2" 1>/tmp/ecf
- ecf=`cat /tmp/ecf`
- # copia o CAPL passando o numero da ecf no nome do novo arquivo
- #copy the CAPL file passing the ecf number to the new file
- scp 192.168.0.$x:/posnet/CAPL$DATA.PDV /tmp/CAPL$DATA.$ecf;
- done
- # monta o compartilhamento, zipa os arquivos, copia para o compartilhamento, remove temporários e fecha-o
- # do mount the share, zip the files, copy to the share folderm, remove the temp files and close the mount
- mount -t cifs -o username={$USUARIO},passwd={$SENHA} //{$IP_SERVER}/{$PASTA_BKP} /mnt
- zip /mnt/CAPLS$DATA.zip /tmp/CAPL*
- rm /tmp/CAPL* -f
- umount /mnt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement