Ajout de la possibilité de lancer manuellement l'export sur un disque déjà branché
This commit is contained in:
parent
e504ceb5a1
commit
ae57511269
2 changed files with 36 additions and 1 deletions
16
README.md
16
README.md
|
@ -136,3 +136,19 @@ udevadm control --reload-rules
|
||||||
```bash
|
```bash
|
||||||
ACTION=add DEVTYPE=disk DEVNAME=/dev/sdg /usr/local/sbin/udev-bkp-usb
|
ACTION=add DEVTYPE=disk DEVNAME=/dev/sdg /usr/local/sbin/udev-bkp-usb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Lancer manuellement l'export des sauvegardes sur un disque USB déjà branché
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Vous pouvez utiliser le script *run-bkp-usb* pour lancer manuellement l'export des sauvegardes sur un disque USB déjà branché :
|
||||||
|
|
||||||
|
```
|
||||||
|
Usage : /usr/local/sbin/run-bkp-usb [device]
|
||||||
|
device To manually run export, provide the USB Drive device path
|
||||||
|
```
|
||||||
|
|
||||||
|
Exemple :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
run-bkp-usb /dev/sdc
|
||||||
|
```
|
||||||
|
|
21
run-bkp-usb
21
run-bkp-usb
|
@ -2,13 +2,32 @@
|
||||||
|
|
||||||
FILE=/var/run/bkp-usb-detected
|
FILE=/var/run/bkp-usb-detected
|
||||||
|
|
||||||
|
|
||||||
|
function usage () {
|
||||||
|
[ -n "$1" ] && echo -e "$1\n"
|
||||||
|
echo "Usage : $0 [device]"
|
||||||
|
echo " device To manually run export, provide the USB Drive device path"
|
||||||
|
[ -n "$1" ] && exit 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
function exit_error () {
|
function exit_error () {
|
||||||
echo "$1"
|
[ -n "$1" ] && echo "$1"
|
||||||
beep -f 300 -l 2000
|
beep -f 300 -l 2000
|
||||||
rm -f "$FILE"
|
rm -f "$FILE"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Manually run
|
||||||
|
if [ -n "$1" ]
|
||||||
|
then
|
||||||
|
[ "$1" == "-h" ] && usage && exit 0
|
||||||
|
DEVICE="$1"
|
||||||
|
[ ! -b "$DEVICE" ] && usage "Invalid device '$DEVICE'"
|
||||||
|
echo -n "$DEVICE" > $FILE
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
[ ! -e "$FILE" ] && exit_error "File $FILE does not exists !"
|
[ ! -e "$FILE" ] && exit_error "File $FILE does not exists !"
|
||||||
|
|
||||||
DEVICE=$( cat "$FILE" )
|
DEVICE=$( cat "$FILE" )
|
||||||
|
|
Loading…
Reference in a new issue