<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.shadoware.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Shadoware.Org - Mot-clé - usb</title>
  <link>http://www.shadoware.org/</link>
  <atom:link href="http://www.shadoware.org/index.php/feed/tag/usb/rss2" rel="self" type="application/rss+xml"/>
  <description>Moi, mes idées, mes logiciels ...</description>
  <language>fr</language>
  <pubDate>Mon, 06 Feb 2012 15:38:11 +0100</pubDate>
  <copyright>Ulrich VANDENHEKKE</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Debian etch - Clé USB</title>
    <link>http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb</link>
    <guid isPermaLink="false">urn:md5:c6317ed8af5191d3802439e3c67d75d4</guid>
    <pubDate>Sat, 04 Aug 2007 13:17:00 +0000</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Linux</category>
        <category>debian</category><category>live</category><category>planet</category><category>usb</category>    
    <description>&lt;p&gt;Il peut être parfois utile de se déplacer ici et là avec une distribution Linux &lt;em&gt;clé en main&lt;/em&gt; sans se trimbaler toujours avec un ordinateur portable ou un CD.&lt;/p&gt;


&lt;p&gt;La clé USB devient alors très utile atteignant aujourd'hui des tailles de l'ordre de 2G pour pas trop cher&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#pnote-22-1&quot; id=&quot;rev-pnote-22-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;. De petite taille, elle peut être utilisée dans des endroits ayant des ordinateurs avec un système d'exploitation propriétaire (ou un autre système libre, ou même pas sans système) mais permettant de démarrer sur un périphérique externe (une clé USB par exemple).&lt;/p&gt;


&lt;p&gt;L'utilité peut-être variable&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Surfer avec une plus grande tranquillité&lt;/li&gt;
&lt;li&gt;Utiliser ses logiciels favoris ( &lt;code&gt;Amarok&lt;/code&gt;, &lt;code&gt;KMyMoney&lt;/code&gt;, &lt;code&gt;KDevelop&lt;/code&gt;, ... )&lt;/li&gt;
&lt;li&gt;Utiliser une interface graphique, bien sûr, meilleure.&lt;/li&gt;
&lt;li&gt;Utiliser dans un système embarqué.&lt;/li&gt;
&lt;li&gt;Tester les ordinateurs portables dans les magasins&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;J'ai trouvé différents sites, tel que &lt;a href=&quot;http://www.breizh-ardente.fr/dotclear/index.php?2006/12/03/57-usbuntu-ou-comment-installer-ubuntu-sur-un-disque-clef-usb-en-mode-persistant&quot;&gt;Ubuntu en mode persistant&lt;/a&gt; permettant d'installer une distribution Ubuntu sur une clé USB ou un disque dur USB.
L'inconvénient de cette méthode est qu'il n'est pas possible d'installer uniquement ce que l'on souhaite partant obligatoirement d'une base LiveCD.&lt;/p&gt;


&lt;p&gt;Ensuite j'ai trouvé d'autres sites, tels que &lt;a href=&quot;http://feraga.com/node/25&quot;&gt;Howto Install a Debian GNU/Linux system onto a USB flash thumb drive&lt;/a&gt; et &lt;a href=&quot;http://www.debian-administration.org/articles/179&quot;&gt;Installing Debian onto USB flash media with everything encrypted.&lt;/a&gt; dont je me suis inspiré pour écrire ce tutoriel.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#rev-pnote-22-1&quot; id=&quot;pnote-22-1&quot;&gt;1&lt;/a&gt;] J'ai par ailleurs acheté récemment une clé USB de 2Go à cet effet pour à peine 15 euros&lt;/p&gt;&lt;/div&gt;
    &lt;h3&gt;Préparation de la clé&lt;/h3&gt;


&lt;h4&gt;Modules&lt;/h4&gt;


&lt;p&gt;Afin de pouvoir accéder à la clé USB, il faut bien évidemment avoir chargé sur sa machine &lt;em&gt;Gnu/Linux&lt;/em&gt; les modules adéquates&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;# modprobe ehci_hcd
# modprobe ohci_hcd 
# modprobe usbhid
# modprobe usb_storage&lt;/pre&gt;


&lt;h4&gt;Logiciels&lt;/h4&gt;


&lt;p&gt;Nous allons considérer que nous sommes sur un système à base de &lt;em&gt;Gnu/Debian&lt;/em&gt; (&lt;em&gt;Ubuntu&lt;/em&gt; devrait pouvoir faire l'affaire). Si vous avez un autre système, il vous faut trouver un moyen d'installer le programme &lt;code&gt;debootstrap&lt;/code&gt;&lt;/p&gt;


&lt;p&gt;Sur un système &lt;em&gt;Gnu/Debian&lt;/em&gt;, il vous suffit de taper la commande, si le programme n'est pas déjà installé&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;# aptitude install debootstrap&lt;/pre&gt;


&lt;h3&gt;Installation du système de base&lt;/h3&gt;


&lt;h4&gt;Partitionnement de la clé USB&lt;/h4&gt;


&lt;p&gt;En premier lieu il faut effectuer le partitionnement de la clé USB. Selon sa taille et aussi de la quantité de logiciel que vous voulez installer il faudra prévoir plus ou moins de place.&lt;/p&gt;


&lt;p&gt;Pour le partitionnement vous pouvez utiliser votre utilitaire favori (&lt;code&gt;parted&lt;/code&gt;, &lt;code&gt;qtparted&lt;/code&gt;, &lt;code&gt;fdisk&lt;/code&gt;, &lt;code&gt;cfdisk&lt;/code&gt;, ...). Le partitionnement que j'ai effectué pour ma propre clé est le suivant&amp;nbsp;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;50Mo pour la partition &lt;strong&gt;/boot&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;1,5Go pour la partition &lt;strong&gt;/&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;le reste pour la partition &lt;strong&gt;/home&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;La partition &lt;strong&gt;/home&lt;/strong&gt; a été séparée afin de pouvoir mettre la partie &lt;strong&gt;/&lt;/strong&gt; de la clé USB en &lt;em&gt;lecture seule&lt;/em&gt; (étape que je n'ai pas encore effectuée).&lt;/p&gt;


&lt;pre&gt;Disk /dev/usb/k2g: 2024 MB, 2024275968 bytes
63 heads, 62 sectors/track, 1012 cylinders
Units = cylinders of 3906 * 512 = 1999872 bytes

       Device Boot      Start         End      Blocks   Id  System
/dev/sda1                   1          26       50747   83  Linux
/dev/sda2                  27         827     1564353   83  Linux
/dev/sda3                 828        1012      361305   83  Linux&lt;/pre&gt;


&lt;p&gt;Une fois les partitions créées vous pouvez les formater pour les utiliser.&lt;/p&gt;


&lt;pre&gt;# mke2fs /dev/sda1 -L live-boot
# mke2fs /dev/sda2 -L live-root
# mke2fs /dev/sda3 -L live-home
# mount /dev/sda2 /mnt
# mkdir /mnt/boot
# mkdir /mnt/home
# mount /dev/sda1 /mnt/boot
# mount /dev/sda3 /mnt/home&lt;/pre&gt;


&lt;h4&gt;Installation à l'aide de debootstrap&lt;/h4&gt;


&lt;p&gt;Une fois les partitions montées on peut installer le système &lt;em&gt;Gnu/Debian&lt;/em&gt; sur la clé USB en utilisant l'utilitaire &lt;code&gt;debootstrap&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;# debootstrap --arch i386 etch /mnt/ ftp://ftp2.fr.debian.org/debian/
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional base dependencies: libdb4.2 libgnutls12 libreadline5
   libsigc++-2.0-0c2a openbsd-inetd readline-common
I: Checking component main on http://ftp.debian.org/debian...
I: Retrieving adduser
...
I: Configuring gnupg...
I: Configuring sysklogd...
I: Configuring klogd...
I: Configuring netbase...
I: Configuring openbsd-inetd...
I: Base system installed successfully.&lt;/pre&gt;


&lt;h4&gt;Dans un Chroot&lt;/h4&gt;


&lt;p&gt;Les opérations suivantes sont à faire sur l'environnement de destination, il faut donc utiliser la commande &lt;code&gt;chroot&lt;/code&gt; pour s'y placer.&lt;/p&gt;


&lt;pre&gt;# chroot /mnt '/bin/bash -i'&lt;/pre&gt;


&lt;h4&gt;Noyaux&lt;/h4&gt;


&lt;p&gt;Une fois le système de base installé, il faut le configurer et y ajouter de quoi démarrer la clé USB.&lt;/p&gt;


&lt;h5&gt;Ajustement et systèmes de fichiers&amp;nbsp;: /etc/fstab&lt;/h5&gt;


&lt;p&gt;Cela dépend de votre configuration, et du partitionnement que vous avez fait. Si vous avez fait le même partitionnement que moi vous devriez avoir un &lt;strong&gt;fstab&lt;/strong&gt; ressemblant à celui là&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;#/etc/fstab: static file system informations.
#
LABEL=live-root    /           ext2    defaults,errors=remount-ro,noatime  0   1
LABEL=live-boot    /boot           ext2    defaults,noatime,ro         0   2
LABEL=live-home    /home           ext2    defaults,noatime            0   2
proc       /proc           proc    defaults                0   0
#tmpfs     /etc/network/run    tmpfs   defaults,noatime            0   0
tmpfs      /tmp            tmpfs   defaults,noatime            0   0
tmpfs      /var/lock       tmpfs   defaults,noatime            0   0
tmpfs      /var/log        tmpfs   defaults,noatime            0   0
tmpfs      /var/run        tmpfs   defaults,noatime            0   0
tmpfs      /var/tmp        tmpfs   defaults,noatime            0   0&lt;/pre&gt;


&lt;p&gt;J'utilise le label de la partition au lieu d'utiliser le &lt;em&gt;block device&lt;/em&gt;. L'utilisation du &lt;em&gt;block device&lt;/em&gt; peut gêner si la clé USB n'est pas toujours détectée dans le même ordre&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#pnote-22-1&quot; id=&quot;rev-pnote-22-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.
Les dossiers temporaires sont tous reportés dans un système de fichier virtuel (en mémoire) à l'aide de &lt;code&gt;tmpfs&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Une fois le fichier &lt;strong&gt;/etc/fstab&lt;/strong&gt; configuré, il ne reste plus qu'à monter les partitions. Pour monter les partitions un simple &lt;code&gt;mount -a&lt;/code&gt; le fait. Il est aussi possible de monter les partitions une à une.&lt;/p&gt;


&lt;p&gt;&lt;ins&gt;Il est possible que la commande suivante faite hors du chroot puisse résoudre certain problème si l'application utilise udev, ...&lt;/ins&gt;&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;mount --bind /dev/ /mnt/dev/&lt;/pre&gt;


&lt;h5&gt;Le réseau&amp;nbsp;: /etc/hostname /etc/hosts&lt;/h5&gt;


&lt;p&gt;Le fichier &lt;strong&gt;/etc/hosts&lt;/strong&gt; doit contenir une ligne indiquant l'adresse du &lt;em&gt;loopback&lt;/em&gt; et le nom de la machine. Ceci afin que &lt;em&gt;KDE&lt;/em&gt; par exemple puisse démarrer&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;127.0.0.1       localhost.localdomain   localhost  liveding&lt;/pre&gt;


&lt;p&gt;Dans le fichier &lt;strong&gt;/etc/hostname&lt;/strong&gt; il faut également mettre le nom de la machine.&lt;/p&gt;


&lt;h5&gt;Apt&amp;nbsp;: /etc/apt/sources.list&lt;/h5&gt;


&lt;p&gt;Le fichier &lt;strong&gt;sources.list&lt;/strong&gt; contient les lignes par défaut suivantes&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;# etch
deb ftp://ftp2.fr.debian.org/debian/ etch main contrib non-free
deb-src ftp://ftp2.fr.debian.org/debian/ etch main contrib
deb http://security.debian.org/ etch/updates main
deb-src http://security.debian.org/ etch/updates main

# etch unofficial
deb http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted&lt;/pre&gt;


&lt;p&gt;Ces lignes permettent de télécharger les paquets par défaut de &lt;em&gt;Gnu/Debian&lt;/em&gt; ainsi que les paquets de sécurité, et les paquets non officiels permettant d'activer certaine fonctionnalité.&lt;/p&gt;


&lt;h5&gt;Initrd&amp;nbsp;: /etc/kernel-img.conf&lt;/h5&gt;


&lt;p&gt;Dans le fichier &lt;strong&gt;/etc/kernel-img.conf&lt;/strong&gt; on enregistre les informations suivantes (afin que &lt;em&gt;Gnu/Debian&lt;/em&gt; crée un fichier &lt;code&gt;initrd&lt;/code&gt; lors de l'installation du noyau)&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;# Kernel Image management overrides
# See kernel-img.conf(5) for details
do_symlinks = Yes
do_initrd = yes&lt;/pre&gt;


&lt;p&gt;Le fichier &lt;code&gt;initrd&lt;/code&gt; permet de charger les modules nécessaires&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#pnote-22-2&quot; id=&quot;rev-pnote-22-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt; au démarrage de &lt;em&gt;Gnu/Linux&lt;/em&gt; sur une clé USB.&lt;/p&gt;


&lt;h5&gt;Installation de paquet&lt;/h5&gt;

&lt;pre&gt;
# aptitude install initrd-tools linux-image-2.6.16-1-686
# aptitude install grub
# aptitude install localepurge
# aptitude clean
# localepurge&lt;/pre&gt;


&lt;p&gt;On installe une image du noyau, ainsi que les outils pour générer l'image &lt;code&gt;initrd&lt;/code&gt;. On installe également &lt;code&gt;grub&lt;/code&gt; qui servira à démarrer sur la clé USB. Le paquet &lt;code&gt;localepurge&lt;/code&gt; permet quant à lui de nettoyer les locales qui prennent un peu trop de place sur la clé USB. Généralement je ne conserve que les locales françaises et anglaises.&lt;/p&gt;


&lt;p&gt;Il est aussi possible d'installer quelques paquets comme un serveur graphique, même voir &lt;em&gt;KDE&lt;/em&gt;, ou encore des outils d'administration. On peut aussi installer des outils qui pourront permettre de réparer une machine.&lt;/p&gt;


&lt;h5&gt;Quelques ajustements.&lt;/h5&gt;


&lt;p&gt;Afin de ne pas écrire trop souvent sur la clé USB, on remplace quelques fichiers.&lt;/p&gt;


&lt;pre&gt;rm -f /etc/blkid.tab*
ln -s /dev/null /etc/blkid.tab
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab&lt;/pre&gt;


&lt;h3&gt;Configuration de grub&lt;/h3&gt;


&lt;p&gt;Afin que la machine puisse démarrer il faut installer &lt;code&gt;grub&lt;/code&gt; sur le secteur de démarrage de la clé USB.
Pour cela, on peut quitter le &lt;code&gt;chroot&lt;/code&gt;. Pour installer &lt;code&gt;grub&lt;/code&gt; on peut utiliser &lt;code&gt;grub-install&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;# grub-install &lt;del&gt;recheck &lt;/del&gt;root-directory=/mnt/ /dev/sda&lt;/pre&gt;


&lt;p&gt;Normalement cela devrait fonctionner &lt;img src=&quot;/dotclear/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt; mais il est possible, si cela ne marche pas d'essayer de l'installer à l'aide de la commande &lt;code&gt;grub&lt;/code&gt; directement (attention le &lt;em&gt;hd1&lt;/em&gt; est à adapter selon votre configuration)&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;# grub
grub&amp;gt; root (hd1,0)
grub&amp;gt; setup (hd1)&lt;/pre&gt;


&lt;p&gt;Il faut également renseigner le fichier &lt;strong&gt;/mnt/boot/grub/menu.lst&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        5

# Pretty colours
color cyan/blue white/blue

## password &lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/&amp;#039;--md5&amp;#039;&quot; title=&quot;&amp;#039;--md5&amp;#039;&quot;&gt;'--md5'&lt;/a&gt; passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title        Windows 95/98/NT/2000
# root     (hd0,0)
# makeactive
# chainloader  +1
#
# title        Linux
# root     (hd0,1)
# kernel   /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=LABEL=live-root rootdelay=5 ro quiet

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=vga=791

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(single-user) single
# altoptions=(single-user mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title      Debian GNU/Linux, kernel 2.6.18-4-686
root       (hd0,0)
kernel     /vmlinuz-2.6.18-4-686 root=LABEL=live-root rootdelay=5 ro quiet vga=791
initrd     /initrd.img-2.6.18-4-686
savedefault

title      Debian GNU/Linux, kernel 2.6.18-4-686 (single-user mode)
root       (hd0,0)
kernel     /vmlinuz-2.6.18-4-686 root=LABEL=live-root rootdelay=5 ro quiet single
initrd     /initrd.img-2.6.18-4-686
savedefault

### END DEBIAN AUTOMAGIC KERNELS LIST&lt;/pre&gt;


&lt;h3&gt;Ajout d'un utilisateur&lt;/h3&gt;


&lt;p&gt;Enfin il ne faut pas oublier d'installer un compte utilisateur&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#pnote-22-3&quot; id=&quot;rev-pnote-22-3&quot;&gt;3&lt;/a&gt;]&lt;/sup&gt;, ainsi que changer le mot de passe &lt;em&gt;root&lt;/em&gt; à l'aide des commandes&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;
# chroot /mnt
# passwd
# adduser toto&lt;/pre&gt;


&lt;h3&gt;Redémarrage et test&lt;/h3&gt;


&lt;p&gt;Il ne reste plus qu'à démonter toutes les partitions et redémarrer la machine.&lt;/p&gt;


&lt;pre&gt;# umount -a
# exit
# reboot&lt;/pre&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#rev-pnote-22-1&quot; id=&quot;pnote-22-1&quot;&gt;1&lt;/a&gt;] Ce qui peut arriver quand on change de machine par exemple.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#rev-pnote-22-2&quot; id=&quot;pnote-22-2&quot;&gt;2&lt;/a&gt;] i.e les modules USB, ...&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#rev-pnote-22-3&quot; id=&quot;pnote-22-3&quot;&gt;3&lt;/a&gt;] Il ne faudrait pas travailler en administrateur, hein !&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2007/08/04/23-debian-etch-cle-usb#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/22</wfw:commentRss>
      </item>
    
  <item>
    <title>Sauvegarde automatique 0.9</title>
    <link>http://www.shadoware.org/post/2006/10/16/20-script-de-sauvegarde-automatique</link>
    <guid isPermaLink="false">urn:md5:035f32068eb22c5626453fd612ea6b00</guid>
    <pubDate>Mon, 16 Oct 2006 10:11:00 +0000</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Linux</category>
        <category>backup</category><category>network</category><category>planet</category><category>script</category><category>usb</category>    
    <description>&lt;p&gt;Ce billet concerne une application, de mon cru, écrite en &lt;code&gt;bash&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Elle utilise l'application &lt;code&gt;dar&lt;/code&gt; pour effectuer des sauvegardes et les copier sur un périphérique USB ou/et sur le réseau.
Tous les patchs, corrections, améliorations sont les bienvenues sur cette application maison.&lt;/p&gt;


&lt;p&gt;Pour fonctionner l'application se configure à l'aide d'un fichier du dossier &lt;code&gt;/etc&lt;/code&gt; qui permet de déterminer une liste de dossier à sauvegarder (&lt;code&gt;/etc/autobackup&lt;/code&gt;). Dans ce fichier, on y défini le dossier à sauvegarde, le dossier de destination, le nombre de sauvegarde incrémentale (ou dit d'une autre facon, au bout de combien fois faut-il créer une nouvelle sauvegarde compléte?).&lt;/p&gt;


&lt;p&gt;Il permet aussi de définir des points de copie où l'on place les différentes sauvegardes. (Ex: un périphérique USB, un dossier SSH).
Ces points sont, bien sûr, utilisés seulement s'ils existent. Le fichier est copié sur le périphérique USB, s'il est branché, sur la machine distante si elle est allumée, ....&lt;/p&gt;



&lt;p&gt;Il ne reste plus qu'à configurer ces petits scripts et les mettre dans un cron&lt;/p&gt;    &lt;h3&gt;Contenu exemple du fichier de configuration&lt;/h3&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# This config file make relation for backup&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Options&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_OPT=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-v -s 4613734400 -D -z9 -m 150&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_EXCLUDE_EXT=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-Z *.avi -Z *.bz2 -Z *.gif -Z *.gz -Z *.jpg -Z *.mov -Z *.mpg -Z *.pbm -Z *.pdf -Z *.png -Z *.pnm -Z *.Z -Z *.zip&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_EXCLUDE_PATH=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-P phoenix/.bogofilter -P phoenix/.fonts -P phoenix/.kde/cache-maxiding -P phoenix/.kde/socket-maxiding -P phoenix/.kde/tmp-maxiding -P phoenix/.spamassassin -P phoenix/.thumbnails -P phoenix/.turboprint -P phoenix/.unison -P phoenix/.wesnoth -P phoenix/.widelands -P phoenix/.wine* -P phoenix/usr -P phoenix/virtuel -P .Trash-* -P phoenix/tmp&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Copy Backup&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;COPYTO=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;usbdrive network&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Copy to usb drive&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;usbdrive_type=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;usb&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;usbdrive_dev=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/dev/usb/disk1&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;usbdrive_mountpoint=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/media/disque/&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;usbdrive_pathname=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;backup/&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Copy to network&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;network_type=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;net&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;network_host=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;miniding&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;network_user=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;phoenix&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# no network_pass : use ssh key for backup&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;network_dir=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/home/phoenix/backup&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Home&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;home_name=&lt;/span&gt;maxiding_home
&lt;span style=&quot;color: #007800;&quot;&gt;home_source=&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;home&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;home_destination=&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gravure&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dar&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;home&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;home_inc_max=&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;10&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Etc&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;etc_name=&lt;/span&gt;maxiding_etc
&lt;span style=&quot;color: #007800;&quot;&gt;etc_source=&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;etc_destination=&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gravure&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dar&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;etc_inc_max=&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;10&lt;/span&gt;&lt;/pre&gt;


&lt;h3&gt;Sauvegarde automatique&lt;/h3&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/bin/sh&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#############################################################################&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   Copyright (C) 2006 by Ulrich Van Den Hekke                            ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   ulrich.vdh@free.fr                                                    ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##                                                                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   This program is free software; you can redistribute it and/or modify  ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   it under the terms of the GNU General Public License as published by  ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   the Free Software Foundation; either version 2 of the License, or     ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   (at your option) any later version.                                   ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##                                                                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# /var &lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   This program is distributed in the hope that it will be useful,       ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   but WITHOUT ANY WARRANTY; without even the implied warranty of        ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   GNU General Public License for more details.                          ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##                                                                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   You should have received a copy of the GNU General Public License     ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   along with this program; if not, write to the                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   Free Software Foundation, Inc.,                                       ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#############################################################################&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -e &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;autobackup &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
    . &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;autobackup
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Please configure the autobackup config file&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$#&lt;/span&gt; -ne &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Please specify a project to backup&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Define name of variable to use&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_name=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_name&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_source=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_source&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_destination=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_destination&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_inc_max=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_inc_max&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Define content of variable for the project&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_SRC=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_source&lt;/span&gt;`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_DST=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_destination&lt;/span&gt;`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_NAME=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_name&lt;/span&gt;`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_INCREMENTAL_MAX=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_inc_max&lt;/span&gt;`
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -z &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$BACKUP_NAME&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Project undefined&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_BIN=&lt;/span&gt;dar
&lt;span style=&quot;color: #007800;&quot;&gt;DATE_BACKUP=&lt;/span&gt;`&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;date&lt;/span&gt; +&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;%&lt;/span&gt;Y&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;%&lt;/span&gt;m&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;%&lt;/span&gt;d`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_ARCHIVE=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;${BACKUP_NAME}_${DATE_BACKUP}&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# From config file&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# COUNT_INCREMENTAL_BACKUP&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# LAST_BACKUP&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# LAST_COMPLETE_BACKUP&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Some options&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -v verbose&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -c archive name&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -R root place&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -s slice size&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -p slice pause&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -D backup empty dir&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -z9 compression gzip level 9&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -m for minimal size&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -Z exclude from compression&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# -P exclude file&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; start_backup&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Backup of $BACKUP_SRC in progress ...&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_BIN&lt;/span&gt; -c &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_ARCHIVE&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt; -R &lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_SRC&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_OPT&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_EXCLUDE_EXT&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_EXCLUDE_PATH&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.log
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; load_backup_config&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; -n &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Load config file ... &amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -e &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
        . &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;loaded.&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;COUNT_INCREMENTAL_BACKUP=&lt;/span&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_INCREMENTAL_MAX&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;not found&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; save_backup_config&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Save backup config file ...&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;COUNT_INCREMENTAL_BACKUP=$COUNT_INCREMENTAL_BACKUP&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;LAST_BACKUP=$DATE_BACKUP&amp;quot;&lt;/span&gt;                          &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;LAST_COMPLETE_BACKUP=$LAST_COMPLETE_BACKUP&amp;quot;&lt;/span&gt;        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; define_incremental&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;There is $COUNT_INCREMENTAL_BACKUP on $BACKUP_INCREMENTAL_MAX&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$COUNT_INCREMENTAL_BACKUP&lt;/span&gt; -lt &lt;span style=&quot;color: #007800;&quot;&gt;$BACKUP_INCREMENTAL_MAX&lt;/span&gt;  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Backup is incremental from $LAST_COMPLETE_BACKUP&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;COUNT_INCREMENTAL_BACKUP=&lt;/span&gt;`&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;expr&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$COUNT_INCREMENTAL_BACKUP&lt;/span&gt; + &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;`
        &lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_OPT=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;-A ${BACKUP_DST}${BACKUP_NAME}_${LAST_COMPLETE_BACKUP} ${BACKUP_OPT}&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Backup is complete&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;COUNT_INCREMENTAL_BACKUP=&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;LAST_COMPLETE_BACKUP=&lt;/span&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$DATE_BACKUP&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
load_backup_config;
define_incremental;
start_backup;
save_backup_config;&lt;/pre&gt;


&lt;h3&gt;Copie automatique&lt;/h3&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/bin/sh&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#############################################################################&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   Copyright (C) 2006 by Ulrich Van Den Hekke                            ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   ulrich.vdh@free.fr                                                    ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##                                                                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   This program is free software; you can redistribute it and/or modify  ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   it under the terms of the GNU General Public License as published by  ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   the Free Software Foundation; either version 2 of the License, or     ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   (at your option) any later version.                                   ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##                                                                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   This program is distributed in the hope that it will be useful,       ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   but WITHOUT ANY WARRANTY; without even the implied warranty of        ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   GNU General Public License for more details.                          ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##                                                                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   You should have received a copy of the GNU General Public License     ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   along with this program; if not, write to the                         ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   Free Software Foundation, Inc.,                                       ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;##   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             ##&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#############################################################################&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -e &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;autobackup &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
    . &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;autobackup
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Please configure the autobackup config file&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$#&lt;/span&gt; -ne &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Please specify a project to backup&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Define name of variable to use&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_name=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_name&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_source=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_source&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_destination=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_destination&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;var_inc_max=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;$1_inc_max&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Define content of variable for the project&lt;/span&gt;
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_SRC=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_source&lt;/span&gt;`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_DST=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_destination&lt;/span&gt;`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_NAME=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_name&lt;/span&gt;`
&lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_INCREMENTAL_MAX=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_inc_max&lt;/span&gt;`
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -z &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$BACKUP_NAME&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Project undefined&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# From config file&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# COUNT_INCREMENTAL_BACKUP&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# LAST_BACKUP&lt;/span&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# LAST_COMPLETE_BACKUP&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; load_backup_config&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; -n &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Load config file ... &amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -e &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
        . &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_NAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;.config
&amp;nbsp;
        &lt;span style=&quot;color: #007800;&quot;&gt;BACKUP_ARCHIVE=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;${BACKUP_NAME}_${LAST_BACKUP}&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;loaded.&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;not found&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;4&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; save_by_network&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; -n &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Save on computer $HOST as $USER on $DIR&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ping&lt;/span&gt; -c &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt; -W &lt;span style=&quot;color: #000000;&quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$HOST&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dev&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;null
&amp;nbsp;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$?&lt;/span&gt; -ne &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt; 
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;failed&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;DESTINATION=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;${HOST}:${DIR}&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -n &lt;span style=&quot;color: #007800;&quot;&gt;$USER&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
            &lt;span style=&quot;color: #007800;&quot;&gt;DESTINATION=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;${USER}@${DESTINATION}&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
        &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;scp&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_ARCHIVE&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$DESTINATION&lt;/span&gt;
&amp;nbsp;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$?&lt;/span&gt; -ne &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt; 
            &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;failed&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
            &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ok&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; save_by_usb&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; -n &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Save on drive $DEV &amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -e &lt;span style=&quot;color: #007800;&quot;&gt;$DEV&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;TOUMOUNT=&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;LINECOUNT=&lt;/span&gt;`&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mount&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$DEV&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cut&lt;/span&gt; -f &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; -d\  &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wc&lt;/span&gt; -l `
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$LINECOUNT&lt;/span&gt; -gt &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
            &lt;span style=&quot;color: #007800;&quot;&gt;MOUNTPOINT=&lt;/span&gt;`&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mount&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$DEV&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cut&lt;/span&gt; -f &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt; -d\ `
            &lt;span style=&quot;color: #007800;&quot;&gt;TOUMOUNT=&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
            &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mount&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$MOUNTPOINT&lt;/span&gt;
&amp;nbsp;
            &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$?&lt;/span&gt; -ne &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
                &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;mount failed &amp;quot;&lt;/span&gt;
            &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -d &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;MOUNTPOINT&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;PATHNAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
            &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; FILE &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;in&lt;/span&gt; `&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;-1&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_DST&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;BACKUP_ARCHIVE&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;*&lt;/span&gt;` ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;do&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;FILENAME=&lt;/span&gt;`&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;basename&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$FILE&lt;/span&gt;` 
                &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; -e &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;MOUNTPOINT&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;PATHNAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;FILENAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
                    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;exist &amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
                    &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;FILE&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;MOUNTPOINT&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;PATHNAME&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&gt;
                &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
            &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;done&lt;/span&gt;
&amp;nbsp;
            &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ok&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
            &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;failed&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$TOUMOUNT&lt;/span&gt; -eq &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;
            &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;umount&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$MOUNTPOINT&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;device not found&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; copy_to&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Start make copy of backup $BACKUP_NAME&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; NAME &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$COPYTO&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;do&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;var_type=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_type&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #007800;&quot;&gt;TYPE=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_type&lt;/span&gt;`
&amp;nbsp;
        &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;--&amp;gt; $NAME as $TYPE&amp;quot;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$TYPE&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;in&lt;/span&gt;
            &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;usb&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;var_dev=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_dev&amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;DEV=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_dev&lt;/span&gt;`
&amp;nbsp;
                &lt;span style=&quot;color: #007800;&quot;&gt;var_mountpoint=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_mountpoint&amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;MOUNTPOINT=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_mountpoint&lt;/span&gt;`
&amp;nbsp;
                &lt;span style=&quot;color: #007800;&quot;&gt;var_pathname=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_pathname&amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;PATHNAME=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_pathname&lt;/span&gt;`
&amp;nbsp;
                save_by_usb;
            &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
            &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;net&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;var_host=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_host&amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;HOST=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_host&lt;/span&gt;`
&amp;nbsp;
                &lt;span style=&quot;color: #007800;&quot;&gt;var_user=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_user&amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;USER=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_user&lt;/span&gt;`
&amp;nbsp;
                &lt;span style=&quot;color: #007800;&quot;&gt;var_dir=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\$&lt;/span&gt;${NAME}_dir&amp;quot;&lt;/span&gt;
                &lt;span style=&quot;color: #007800;&quot;&gt;DIR=&lt;/span&gt;`&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;eval&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$var_dir&lt;/span&gt;`
&amp;nbsp;
                save_by_network;
            &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;;;&lt;/span&gt;
        &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;esac&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;done&lt;/span&gt;
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
copy_to;&lt;/pre&gt;</description>
    
    
    
          <comments>http://www.shadoware.org/post/2006/10/16/20-script-de-sauvegarde-automatique#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2006/10/16/20-script-de-sauvegarde-automatique#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/19</wfw:commentRss>
      </item>
    
</channel>
</rss>
