Hi, --- On Wed, Dec 31, 2008 at 9:54 AM, partha chowdhury <[email protected]> wrote: | #!/bin/bash | #checks if usb drive is present | if blkid |grep USB-Mass-Storage | then | #checks if user is logged in otherwise it may cause problem | if users|grep freedom | then | echo "user freedom is logged in" && exit 1 #if user is logged it exits | immediately | else \--
* Why check for USB storage if user is not logged in? * What is blkid here? If you have many USB-storage devices, how can you tell which one to use? Checking for appropriate device can be done with udev. --- | #checks if destination folder exists | if [ -d /media/backup ] \-- No magic numbers. Use a variable. --- | #mounts the usb drive | /bin/mount LABEL=USB-Mass-Storage /media/backup \-- You are checking for USB drive, then user is logged in and then mounting USB storage, why? Why does the user have to be logged in just to do a backup? You can write udev rules on connection of a particular USB device to perform actions such as syncing/backing up files: http://www.reactivated.net/writing_udev_rules.html#external-run --- | /root/backup.log \-- You don't need to use /root for a user to just backup/sync files to external storage. SK -- Shakthi Kannan http://www.shakthimaan.com _______________________________________________ Users mailing list [email protected] http://lists.dgplug.org/listinfo.cgi/users-dgplug.org
