[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [TEKNIK] god måde at kontroller en netforbindelse



sslug@sslug skrev:

> Jeg pølser på at lave et backup script som kører backup med rsync via
> en ssl. Det i sig selv er ikke så svært.
>
> Men jeg kunne godt tænke mig at den kun gør det når den har en
> forbindelse til backup serveren fx over 2 Mb.
>
> Nogen der har nogle bud til hvordan det kan gøres?

Du kan bruge indholdet af »/proc/net/dev« til at se hvor hurtigt du får
flyttet data over dit netværk.

   rsync ... &
   bytes_0=$(find_overførte_bytes)
   sleep 8
   bytes_1=$(find_overførte_bytes)
   let hastighed_i_bit_per_sekund="${bytes_1} - ${bytes_0}"
   if [ ${hastighed} -lt 2097152 ]; then
      killall rsync
   fi

Hvor »find_overførte_bytes« for eksempel kan være defineret sådan her:

   find_overførte_bytes='grep "wlan0:" /proc/net/dev | perl -lpe "s|[\t ]+| |g" | cut -d" " -f3'

Jeg er lidt usikker på hvor ofte »/proc/net/dev« opdateres.  Det kan
godt være at »sleep 8« skal justeres.

God fornøjelse,

Jacob
-- 
Dagens billede:
                  http://billeder.sparre-andersen.dk/dagens/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2012-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *