Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.39 KB | None | 0 0
  1. #/bin/bash
  2.  
  3. # Por Tales Mendonca
  4. # 14 de Set de 2014
  5. # talesam@gmail.com
  6. # Script para realizar sincronia com a conta do MEGA
  7.  
  8. # Variáveis
  9. dir1="$HOME/Documentos"
  10. dir2="$HOME/Imagens"
  11. dir3="$HOME/Música"
  12. dir4="$HOME/scripts"
  13. dir5="$HOME/Servidor"
  14. dir6="$HOME/Vídeos"
  15.  
  16. # Corpo do script
  17. while : ; do
  18.     if [[ "$(ping -c 1 8.8.8.8 | grep '100% packet loss' )" != "" ]]; then
  19.         echo "Sem conexão no momento, tentano novamente em 30s..."
  20.         sleep 30
  21.     else
  22.         echo "Atualizando os diretórios..."
  23.         megals --reload 2>/dev/null # Lista todos os diretórios e atualiza o cache local com a nuvem
  24.         echo "Sincronizando arquivos..."
  25.         megasync -l $dir1 -r /Root/Documentos 2>/dev/null # Enviar
  26.         megasync -l $dir1 -r /Root/Documentos -d 2>/dev/null # Baixar
  27.  
  28.         #megasync -l $dir2 -r /Root/Imagens 2>/dev/null # Enviar
  29.         #megasync -l $dir2 -r /Root/Imagens -d 2>/dev/null # Baixar
  30.  
  31.         megasync -l $dir3 -r /Root/Música 2>/dev/null # Enviar
  32.         megasync -l $dir3 -r /Root/Música -d 2>/dev/null # Baixar
  33.  
  34.         megasync -l $dir4 -r /Root/scripts 2>/dev/null # Enviar
  35.         megasync -l $dir4 -r /Root/scripts -d 2>/dev/null # Baixar
  36.  
  37.         #megasync -l $dir5 -r /Root/Servidor 2>/dev/null # Enviar
  38.         #megasync -l $dir5 -r /Root/Servidor -d 2>/dev/null # Baixar
  39.  
  40.         #megasync -l $dir6 -r /Root/Vídeos 2>/dev/null # Enviar
  41.         #megasync -l $dir6 -r /Root/Vídeos -d 2>/dev/null # Baixar
  42.  
  43.         sleep 30
  44.     fi
  45. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement