mit udev oder hal ?
Es soll eine Backupplatte sein an einem Server, am besten soll gleich noch rsync mitstarten, jedoch weiß ich noch nicht wie ich am besten dann einem windowsclient mitteile, dass das backup fertig ist. Für Ideen wäre ich dankbar
![Smile :)](./images/smilies/icon_smile.gif)
UDEV zum Einhängen und zum Starten deines rsync-Skripts.Tegger hat geschrieben:mit udev oder hal ?
Code: Alles auswählen
[ 245.874196] ata3: exception Emask 0x10 SAct 0x0 SErr 0x4090000 action 0xe frozen
[ 245.874467] ata3: irq_stat 0x00400040, connection status changed
[ 245.874626] ata3: SError: { PHYRdyChg 10B8B DevExch }
[ 245.874789] ata3: hard resetting link
[ 246.596550] ata3: SATA link down (SStatus 0 SControl 300)
[ 251.596541] ata3: hard resetting link
[ 251.901551] ata3: SATA link down (SStatus 0 SControl 300)
[ 251.901720] ata3: limiting SATA link speed to 1.5 Gbps
[ 254.747380] ata3: hard resetting link
[ 260.100543] ata3: link is slow to respond, please be patient (ready=0)
[ 260.865554] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[ 260.882689] ata3.00: configured for UDMA/133
[ 260.882847] ata3: EH complete
jou... es wird somit zum /dev/"Name" den man in der udev rule vergeben hat, das war das fehlende stückchenClio hat geschrieben:Vielleicht hilft das weiter, ist zwar schon etwas älter aber gut erklärt.
Die zweite Seite dürfte Dich interessieren:
Wozu der Supertanker wenn das Gummiboot genügt, schau Dir mal webfs an, ist perfekt für so etwasmir kam schon zwischenzeitlich so ne art statuspage per apache oder so...wobei ich dann extra apache installieren müsste
Code: Alles auswählen
This is a simple http server for purely static content. You can
use it to serve the content of a ftp server via http for example.
It is also nice to export some files quickly by starting an http
server in a few seconds without editing a config file first.
Features/Design:
================
* single process: select() + non-blocking I/O
* automatically generates directory listings when asked for a
directory (check for index.html available as option), caches
the listings.
* no config file, just a few switches. Try "webfsd -h" for a
list.
pferdefreund hat geschrieben:und mit irgend einem Samba-Tool kann man Windows-messages
verschicken - kann dann auch das rsync-Script erledigen
Code: Alles auswählen
0:~# cat /etc/udev/rules.d/96-hotplug.rules
SUBSYSTEM=="block", KERNEL=="sd*[0-9]", ENV{ID_SERIAL_SHORT}=="S09QJ1UL500XXX" NAME="backup" RUN="sh /root/backup.sh"
0:~# cat /root/backup.sh
#!/bin/sh
# Einfaches Backup
mount /dev/backup /media/backup/
mount 192.168.123.215:/RAID /media/nfs/
rsync -a /media/nfs/ /media/backup/
umount /media/backup
umount /media/nfs
0:~#
Sicher?Tegger hat geschrieben:als 70-backup.rules die backup.sh in einer endlosschleife läuft
Code: Alles auswählen
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="a940cbf1-c6d7-4653-86db-da5fea65e464", RUN+="/bin/sh /usr/local/bin/backup.sh"
Code: Alles auswählen
#!/bin/sh
{
touch /tmp/timestamp_begin_$(date +%Y_%m_%d_%H:%M:%S)
/bin/mount /dev/disk/by-uuid/a940cbf1-c6d7-4653-86db-da5fea65e464 /media/backup && touch /tmp/timestamp_mount_$(date +%Y_%m_%d_%H:%M:%S)
sleep 30;
umount /mnt/backup && touch /tmp/timestamp_umount_$(date +%Y_%m_%d_%H:%M:%S)
touch /tmp/timestamp_end_$(date +%Y_%m_%d_%H:%M:%S)
} &
Code: Alles auswählen
mount 192.168.123.215:/RAID /media/nfs/
rsync -a /media/nfs/ /media/backup/
umount /media/nfs
Code: Alles auswählen
udevadm monitor
Code: Alles auswählen
TEST:~# cat /usr/local/bin/backup.sh
#!/bin/sh
{
touch /tmp/timestamp_begin_$(date +%Y_%m_%d_%H:%M:%S)
/bin/mount /dev/disk/by-uuid/a940cbf1-c6d7-4653-86db-da5fea65e464 /media/backup && touch /tmp/timestamp_mount_$(date +%Y_%m_%d_%H:%M:%S)
mount 192.168.123.215:/RAID /media/nfs/
/usr/bin/rsync -a /media/nfs/ /media/backup/
/bin/umount /media/nfs
/bin/umount /media/backup && touch /tmp/timestamp_umount_$(date +%Y_%m_%d_%H:%M:%S)
touch /tmp/timestamp_end_$(date +%Y_%m_%d_%H:%M:%S)
} &
TEST:~#
Code: Alles auswählen
TEST:~# dir -l /media/backup/
insgesamt 0
TEST:~# dir -l /media/nfs
insgesamt 0
TEST:~# dir -l /media/backup/
insgesamt 0
TEST:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
none on /selinux type selinuxfs (rw,relatime)
xenfs on /proc/xen type xenfs (rw)
TEST:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
none on /selinux type selinuxfs (rw,relatime)
xenfs on /proc/xen type xenfs (rw)
/dev/sde1 on /media/backup type ext3 (rw)
192.168.123.215:/RAID on /media/nfs type nfs (rw,addr=192.168.123.215)
TEST:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
none on /selinux type selinuxfs (rw,relatime)
xenfs on /proc/xen type xenfs (rw)
/dev/sde1 on /media/backup type ext3 (rw)
TEST:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
none on /selinux type selinuxfs (rw,relatime)
xenfs on /proc/xen type xenfs (rw)
TEST:~# dir -l /media/backup/
insgesamt 48
drwxrwxr-x 4 userle userle 4096 24. Sep 11:13 10
drwxrwxr-x 3 userle userle 4096 4. Okt 18:55 3DSCHRIFT
drwxrwxr-x 10 userle userle 4096 30. Sep 15:50 Auto
drwxrwxr-x 7 userle userle 4096 24. Sep 11:12 DVD_Rebuilder_Free_098.1
drwxrwxr-x 3 userle userle 12288 30. Sep 17:34 Good\ old\ Techno
drwxrwxr-x 3 userle userle 4096 4. Okt 18:55 Imagemagick
drwxrwxr-x 3 userle userle 4096 14. Okt 19:07 nightsdark
drwxrwxr-x 3 userle userle 4096 4. Okt 18:56 Panorama\ Bilder\ erstellen\ Autostich
drwxrwxr-x 4 userle userle 4096 4. Okt 18:56 Panorama\ Bilder\ erstellen\ EnBlend
drwxrwxr-x 2 userle userle 4096 4. Okt 18:55 XYZ
TEST:~#
Code: Alles auswählen
CHECK=`mount | grep /media/backup | awk '{print $3}'`
if [`$CHECK` == `/media/backup`]; then
/usr/bin/rsync -a --delete /media/nfs/ /media/backup/
fi
Unwahrscheinlich.Tegger hat geschrieben:Kann es sein, dass das Skript auch beim Deaktivieren der Platte ausgeführt wird und daher auch rsync ausgeführt wird, obwohl /dev/sde nicht gemountet ist ?
Tegger hat geschrieben:Code: Alles auswählen
if [`$CHECK` == `/media/backup`]; then
Code: Alles auswählen
if [ "$CHECK" == "/media/backup" ];