All of lore.kernel.org
 help / color / mirror / Atom feed
* udev rule won't execute RUN command
@ 2009-11-12  9:28 root
  2009-11-12 18:26 ` root
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: root @ 2009-11-12  9:28 UTC (permalink / raw)
  To: linux-hotplug

dear all:
  The rule I've created is in .60-shili-test.rules and is as follows:
KERNELS="1-6",ATTRS{idVendor}="0525",NAME="shili",RUN+="/bin/rm
-rf /home/shili/test/tt.c"

and the udevtest show:
------------------------------------------------------------------
   This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

parse_file: reading '/etc/udev/rules.d/60-shili-test.rules' as rules
file
parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules
file
parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules
file
udev_rules_new: rules use 456 bytes tokens (38 * 12 bytes), 314 bytes
buffer
udev_rules_new: temporary index used 500 bytes (25 * 20 bytes)
udev_device_new_from_syspath: device 0xb83da738 has devpath
'/devices/pci0000:00/0000:00:1d.7/usb1/1-6'
udev_device_new_from_syspath: device 0xb83da8d8 has devpath
'/devices/pci0000:00/0000:00:1d.7/usb1/1-6'
udev_device_read_db: device 0xb83da8d8 filled with db symlink data
'/dev/shili'
udev_rules_apply_to_event: NAME
'shili' /etc/udev/rules.d/60-shili-test.rules:1
udev_rules_apply_to_event: RUN ''/bin/rm
-rf /home/shili/test/tt.c'' /etc/udev/rules.d/60-shili-test.rules:1
udev_device_update_db: create db link (shili)
udev_node_add: creating device node '/dev/shili', devnum\x189:21,
mode\x0660, uid=0, gid=0
udev_node_mknod: preserve file '/dev/shili', because it has correct
dev_t
udevadm_test: run: '/bin/rm -rf /home/shili/test/tt.c'
----------------------------------------------------------------
but when i check the file  /home/shili/test/tt.c, it still exsit,why?
i've try lots of ways, but it still can't work, need your help, thanks
in advance!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udev rule won't execute RUN command
  2009-11-12  9:28 udev rule won't execute RUN command root
@ 2009-11-12 18:26 ` root
  2009-11-12 22:52 ` Alan Jenkins
  2009-11-13 12:15 ` Alan Jenkins
  2 siblings, 0 replies; 4+ messages in thread
From: root @ 2009-11-12 18:26 UTC (permalink / raw)
  To: linux-hotplug

thanks to alan,
i used the command udevadm trigger --action=change, but
there is no any output, so i changed the rule like this:
ACTION="add",ATTRS{idVendor}="0525",NAME="shili",RUN+="/bin/rm
-rf /home/shili/test/tt.c. but the file /home/shili/test/tt.c is still
exsit when i plug it in or out,and when i use udevadm trigger
--action­d, there is still no output in the console. 
BTW:when i plug in the dev the name is changed 

> dear all:
>   The rule I've created is in .60-shili-test.rules and is as follows:
> KERNELS="1-6",ATTRS{idVendor}="0525",NAME="shili",RUN+="/bin/rm
> -rf /home/shili/test/tt.c"
>
> and the udevtest show:
> ------------------------------------------------------------------
>    This program is for debugging only, it does not run any program,
> specified by a RUN key. It may show incorrect results, because
> some values may be different, or not available at a simulation run.
>
> parse_file: reading '/etc/udev/rules.d/60-shili-test.rules' as rules
> file
> parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as
rules
> file
> parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as
rules
> file
> udev_rules_new: rules use 456 bytes tokens (38 * 12 bytes), 314 bytes
> buffer
> udev_rules_new: temporary index used 500 bytes (25 * 20 bytes)
> udev_device_new_from_syspath: device 0xb83da738 has devpath
> '/devices/pci0000:00/0000:00:1d.7/usb1/1-6'
> udev_device_new_from_syspath: device 0xb83da8d8 has devpath
> '/devices/pci0000:00/0000:00:1d.7/usb1/1-6'
> udev_device_read_db: device 0xb83da8d8 filled with db symlink data
> '/dev/shili'
> udev_rules_apply_to_event: NAME
> 'shili' /etc/udev/rules.d/60-shili-test.rules:1
> udev_rules_apply_to_event: RUN ''/bin/rm
> -rf /home/shili/test/tt.c'' /etc/udev/rules.d/60-shili-test.rules:1
> udev_device_update_db: create db link (shili)
> udev_node_add: creating device node '/dev/shili', devnum\x189:21,
> mode\x0660, uid=0, gid=0
> udev_node_mknod: preserve file '/dev/shili', because it has correct
> dev_t
> udevadm_test: run: '/bin/rm -rf /home/shili/test/tt.c'
> ----------------------------------------------------------------
> but when i check the file  /home/shili/test/tt.c, it still exsit,why?
> i've try lots of ways, but it still can't work, need your help, thanks
> in advance!

udevadm test doesn't actually run the command, it just shows you what
would be run.  Have you tried using udevadm trigger instead?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udev rule won't execute RUN command
  2009-11-12  9:28 udev rule won't execute RUN command root
  2009-11-12 18:26 ` root
@ 2009-11-12 22:52 ` Alan Jenkins
  2009-11-13 12:15 ` Alan Jenkins
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Jenkins @ 2009-11-12 22:52 UTC (permalink / raw)
  To: linux-hotplug

On 11/12/09, root <belle.shi@yy.com> wrote:
> dear all:
>   The rule I've created is in .60-shili-test.rules and is as follows:
> KERNELS="1-6",ATTRS{idVendor}="0525",NAME="shili",RUN+="/bin/rm
> -rf /home/shili/test/tt.c"
>
> and the udevtest show:
> ------------------------------------------------------------------
>    This program is for debugging only, it does not run any program,
> specified by a RUN key. It may show incorrect results, because
> some values may be different, or not available at a simulation run.
>
> parse_file: reading '/etc/udev/rules.d/60-shili-test.rules' as rules
> file
> parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules
> file
> parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules
> file
> udev_rules_new: rules use 456 bytes tokens (38 * 12 bytes), 314 bytes
> buffer
> udev_rules_new: temporary index used 500 bytes (25 * 20 bytes)
> udev_device_new_from_syspath: device 0xb83da738 has devpath
> '/devices/pci0000:00/0000:00:1d.7/usb1/1-6'
> udev_device_new_from_syspath: device 0xb83da8d8 has devpath
> '/devices/pci0000:00/0000:00:1d.7/usb1/1-6'
> udev_device_read_db: device 0xb83da8d8 filled with db symlink data
> '/dev/shili'
> udev_rules_apply_to_event: NAME
> 'shili' /etc/udev/rules.d/60-shili-test.rules:1
> udev_rules_apply_to_event: RUN ''/bin/rm
> -rf /home/shili/test/tt.c'' /etc/udev/rules.d/60-shili-test.rules:1
> udev_device_update_db: create db link (shili)
> udev_node_add: creating device node '/dev/shili', devnum\x189:21,
> mode\x0660, uid=0, gid=0
> udev_node_mknod: preserve file '/dev/shili', because it has correct
> dev_t
> udevadm_test: run: '/bin/rm -rf /home/shili/test/tt.c'
> ----------------------------------------------------------------
> but when i check the file  /home/shili/test/tt.c, it still exsit,why?
> i've try lots of ways, but it still can't work, need your help, thanks
> in advance!

udevadm test doesn't actually run the command, it just shows you what
would be run.  Have you tried using udevadm trigger instead?

Regards
Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udev rule won't execute RUN command
  2009-11-12  9:28 udev rule won't execute RUN command root
  2009-11-12 18:26 ` root
  2009-11-12 22:52 ` Alan Jenkins
@ 2009-11-13 12:15 ` Alan Jenkins
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Jenkins @ 2009-11-13 12:15 UTC (permalink / raw)
  To: linux-hotplug

On 11/12/09, root <belle.shi@yy.com> wrote:
> thanks to alan,
> i used the command udevadm trigger --action=change, but
> there is no any output,

You wanted "udevadm trigger --action­d", to match the ACTION="add"
test in your rule.

> so i changed the rule like this:
> ACTION="add",ATTRS{idVendor}="0525",NAME="shili",RUN+="/bin/rm
> -rf /home/shili/test/tt.c. but the file /home/shili/test/tt.c is still
> exsit when i plug it in or out,and when i use udevadm trigger
> --action­d, there is still no output in the console.
> BTW:when i plug in the dev the name is changed

udevadm trigger doesn't print anything useful, so that part is
expected.  Given that the NAME="..." is working for this rule, I have
no idea why RUN+="..." isn't working.

Have you looked for errors in the log output, e.g. in
/var/log/messages?  You might try running "udevadm control
--log-priority=info" first, to get more information logged.

Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-13 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-12  9:28 udev rule won't execute RUN command root
2009-11-12 18:26 ` root
2009-11-12 22:52 ` Alan Jenkins
2009-11-13 12:15 ` Alan Jenkins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.