udev do not provide any output but you can use
notify-send(libnotify-bin). Use this script
alt-notify-send(http://gnome-hacks.org/hacks.html?id=82).



#!/bin/sh

users=$(who -u | grep '(:[0-9])' | cut -d' ' -f1)
su $user alt-notify-send "usb-check" "Scanning USB" 0
avgscan -scan /media/$1 -report /tmp/scan.log
su $user alt-notify-send "usb-check"  "Scanning complete; pls check 
/tmp/scan.log for details" 0



--- On Tue, 3/17/09, plug bert <[email protected]> wrote:
From: plug bert <[email protected]>
Subject: Re: [plug] Antivirus-for-Windows Linux programs (was: AntiVirus for 
Linux with real time scanning, reporting)
To: "Philippine Linux Users' Group (PLUG) Technical Discussion List" 
<[email protected]>, [email protected]
Date: Tuesday, March 17, 2009, 2:40 PM

Hello All,

  i fiddled around with udev rules this afternoon...added the ff rule:


     KERNEL=="sda1", ACTION=="add",
RUN+="/tmp/avscan.sh /media/%k "


avscan.sh is as follows:

#########################################################################
#!/bin/bash
/usr/bin/zenity --info --text "Scanning $1"
avgscan -scan /media/$1 -report /tmp/scan.log
/usr/bin/zenity --info --text "Scanning complete; pls check /tmp/scan.log
for details"

#########################################################################


   i've also added the ff line to /etc/fstab, to pin down the mount point:


     /dev/sda1       /media/sda1     auto    rw,user,noauto,exe  0       0



   i've verified that avgscan gets exeuted whenever i plug in a usb
drive...but for some reason i didn't get the info boxes that zenity was
supposed to generate. Any ideas?






--- On Tue, 3/17/09, greek ordono <[email protected]> wrote:

> From: greek ordono <[email protected]>
> Subject: Re: [plug] Antivirus-for-Windows Linux programs (was: AntiVirus
for Linux with real time scanning, reporting)
> To: "Philippine Linux Users' Group (PLUG) Technical Discussion
List" <[email protected]>
> Date: Tuesday, March 17, 2009, 5:55 PM
> IMHO,
> it easier to do this with udev.
> 
> ex.
> /etc/udev/rules.d/85-custom-crypt
> SUBSYSTEM=="usb",
> DRIVERS!="usb-storage",
> GOTO="cryptsetup_end"
> ACTION=="add", 
> ENV{ID_FS_TYPE}=="crypto_LUKS",
> RUN+="/lib/udev/custom-crypt"
> ACTION=="remove",
> ENV{ID_FS_TYPE}=="crypto_LUKS",
> RUN+="/lib/udev/custom-crypt"
> LABEL="cryptsetup_end"
> 
> /lib/udev/custom-crypt
> #!/bin/sh
> #ACTION=add # provided by udev
> #DEVNAME="/dev/sda" # provided by udev
> 
> ill_do_what_ever_i_want
> 
> exit 0
> 
> 
> 
> 
> --- On Tue, 3/17/09, plug bert
> <[email protected]> wrote:
> From: plug bert
> <[email protected]>
> Subject: Re: [plug] Antivirus-for-Windows Linux programs
> (was: AntiVirus for Linux with real time scanning,
>  reporting)
> To: "Philippine Linux Users' Group (PLUG)
> Technical Discussion List"
> <[email protected]>
> Date: Tuesday, March 17, 2009, 9:43 AM
> 
> 
> 
> thanks to all who replied...will definitely try the
> dbus/udev thingy
> 
> 
> 
> --- On Tue, 3/17/09, Alvin Delagon
> <[email protected]> wrote:
> 
> > From: Alvin Delagon <[email protected]>
> > Subject: Re: [plug] Antivirus-for-Windows Linux
> programs (was: AntiVirus
> for Linux with real time scanning, reporting)
> > To: "Philippine Linux Users' Group (PLUG)
> Technical Discussion
> List" <[email protected]>
> > Date: Tuesday, March 17, 2009, 3:10 PM
> > Oh look somebody already thought about
> > this already:
> > 
> >
>
http://stackoverflow.com/questions/469243/how-can-i-listen-for-usb-device-inserted-events-in-linux-in-python
> > 
> > 
> > All you have to do is import the subprocess module
> and
> >
>  insert a subprocess.call(<clamAV shell command
> > here...>) somewhere in the do_something method.
> > 
> > :-)
> > 
> > ---
> > Alvin
> > 
> > 
> > On Tue, Mar 17, 2009 at 9:48 AM, Alvin Delagon
> <[email protected]>
> > wrote:
> > 
> > KDE uses dbus. You can write a program that will
> listen to
> > some events.
> > 
> > ---
> > Alvin
> > 
> > On Mon, Mar 16, 2009 at 9:42 PM,
> > Michael Tinsay <[email protected]>
> > wrote:
> > 
> > 
> > 
> > 
> > ----- Original Message ----
> > 
> > > From: plug bert <[email protected]>
> > 
> > >
> > 
> > >   Basically we want to automate things for
> > our users..and we really don't trust
> > 
> > > them to do a manual scan. Much safer to perform a
> real
> > time scan the instant the
> > 
> > > usb drive is plugged in.
> >
>  
> > >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > I use KDE.  Whenever I insert a flash drive, it
> > opens konqueror.  I think there is a way to have it
> do
> > something else, like run a virus scanner on it.
> > 
> > 
> > 
> > --- mike t.
> > 
> > _________________________________________________
> > 
> > Philippine Linux Users' Group (PLUG) Mailing List
> > 
> > http://lists.linux.org.ph/mailman/listinfo/plug
> > 
> > Searchable Archives: http://archives.free.net.ph
> > 
> > 
> > 
> > 
> > -- 
> > http://www.alvinatorsplayground.blogspot.com/
> > 
> > 
> > 
> > 
> > 
> > -- 
> > http://www.alvinatorsplayground.blogspot.com/
> > 
> > 
> > -----Inline Attachment Follows-----
> > 
> > _________________________________________________
> > Philippine Linux Users' Group (PLUG) Mailing
>  List
> > http://lists.linux.org.ph/mailman/listinfo/plug
> > Searchable Archives: http://archives.free.net.ph
> 
> 
>       
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
> 
> 
> 
>       
> -----Inline Attachment Follows-----
> 
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph


      
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph



      
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to