Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a set of udev rules to mount and then execute a BASH script when a USB stick is inserted. That works fine (stick is properly mounted and some script commands execute properly) but a find command within the script DOESN'T work if the script is invoked by udev. The find command part does work if I run the script from the command line ?!
The UDEV rules and the find command are below. Any ideas as to what this could be?? I think it may have something to do with the environment setup for the UDEV script but I'm not sure what to do next.
My UDEV RULES::
debian4:/opt# cat /etc/udev/rules.d/z10-local.rules
# made by me 12/26/2007
# trying to handle the 1st partition of sda,sdb, or sdc (for now)
ACTION=="add", KERNEL=="sd[a-z][1-9]", SUBSYSTEM=="block", RUN+="/bin/mount /dev/%k"
ACTION=="remove", KERNEL=="sd[a-z][1-9]", SUBSYSTEM=="block", RUN+="/bin/umount /dev/%k"
ACTION=="add", KERNEL=="sd[abc]1", SUBSYSTEM=="block", RUN+="/bin/bash -c '/opt/usbmgmt &'"
The /media/$usbmnt is the mount point of the stick where $usbmnt is a BASH shell variable and gets avalue of either stick1, stick2, or stick3 (corresponding to /dev/sda1, 2 , or 3). The script properly resolves the value for this variable (regardless of which way the script is invoked).
I tryed specifying the full paths to find and cp and see if that was the answer. Thanks for that idea. But alas, same behavior.
I do still think it must have something to do with the udev-established environment for the script (or lack thereof). Any more ideas?
Happy New Year!!
PS I was thinking of using xargs instead of the -exec (or execdir) but I don't know how to put the cp command behind the args statement.
I also thought about breaking it up so find runs (having it store the file list). The the next step would read the filelist and cp it to the stick. Not quite sure how to do this either.
Does either approach sound promising?