Re: which system runs scripts when USB devices plugged in?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/10/2010 04:26 AM, Nick Urbanik wrote:
> Dear Patrick,
>
> On 09/11/10 22:16 -0430, Patrick O'Callaghan wrote:
>> On 11/09/2010 03:44 PM, Nick Urbanik wrote:
>>> Dear Folks,
>>>
>>> I have written a Perl program to copy podcasts onto my iriver device
>>> when it is plugged in.  I want to be able to run it automatically.
>>> Which system in Fedora 14 is the most appropriate place to run such a
>>> script from?
>>>
>>> udev?  /etc/modprobe.d/*?  /sbin/hotplug is not there any more.
>>
>> Udev. Take a look at /etc/udev/rules.d/*
>
> Thank you for that.  I am familiar with udev, and was under the
> impression that it is mainly for creating devices and links to devices
> that are predictable.
>
> If udev is the path I should tread for this, then I will do so.  But
> is that really the most appropriate place?

I have an /etc/udev/scripts directory on my system that runs some small 
scripts when stuff is plugged in (called from the rules entry of 
course). I don't know if that's the canonical place but it works and I 
know I didn't invent it.

If your script is liable to run for a long time (and it sounds like it 
might) you might want to consider splitting it in two, firstly a trigger 
which calls the main program asynchronously and returns immediately, and 
secondly the main program (which of course can live somewhere else) that 
does the actual copying. You'd also need to think about whether the main 
program is reentrant (can be run multiple times without finishing) but 
you'd need to consider that in any case.

My knowledge of udev is hazy at best, so I don't know if this precaution 
is really necessary, but you can have fun programming it :-)

poc
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux