In short; create this file (*  /etc/udev/rules.d/11-backup-auto-mount.rules
) *by copying and pasting the text between the start and end tags:

 --- start ---
* *
KERNEL!="sd[a-z][0-9]", GOTO="backup_auto_mount_end"

# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"

# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs",
ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"

# Mount the device
ACTION=="add", RUN+="/bin/mount -o $env{mount_options} /dev/%k
/var/lib/asterisk/backups"

# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l
/var/lib/asterisk/backups"

# Exit
LABEL="backup_auto_mount_end"

 --- end ---

You can then insert and remove your key without touching the system. (I'm
making a lot of assumptions about FreePBX that should be correct, for
example that it uses udev).

Lots more suggestions on udev rules here:

https://wiki.archlinux.org/index.php/Udev#Auto_mounting_USB_devices

-- 
John Lange
www.johnlange.ca

On Mon, Dec 13, 2010 at 4:05 PM, Henry Coleman <henry.cole...@voip-pbx.ca>wrote:

> Thanks for all the suggestions. So far I think that Doug' solution looks
> the most promising, however
> it needs automating so that inserting the USB stick will automatically
> "mount" the stick and disconnection will "umount" the stick.
> (A sort of plug and play if you will) Restore might work also based on this
> principle.
>
> So I'm gonna pick your Linux brains (again) and ask if this can be done?
> Henry   [?]
>
>

Reply via email to