svn commit: r366578 - head/sbin/devd

Renato Botelho garga at FreeBSD.org
Fri Oct 9 18:20:52 UTC 2020


On 09/10/20 15:16, Renato Botelho wrote:
> On 09/10/20 13:57, Warner Losh wrote:
>>
>>
>> On Fri, Oct 9, 2020 at 10:19 AM Renato Botelho <garga at freebsd.org 
>> <mailto:garga at freebsd.org>> wrote:
>>
>>     On 09/10/20 12:29, Warner Losh wrote:
>>      > Author: imp
>>      > Date: Fri Oct  9 15:29:05 2020
>>      > New Revision: 366578
>>      > URL: https://svnweb.freebsd.org/changeset/base/366578
>>     <https://svnweb.freebsd.org/changeset/base/366578>
>>      >
>>      > Log:
>>      >    Avoid using single quotes in arguments to logger.
>>      >
>>      >    Single quotes interfere with the workaround put in with
>>     r335753 and
>>      >    aren't necessary in this case. I believe that all the
>>     underling issues
>>      >    with r335753 have been corrected, but need to do more extensive
>>      >    followup before reverting it as a bad idea.
>>
>>     Hi Warner,
>>
>>     How to proceed if it's needed to pass multiple parameters to a 
>> command
>>     in following format?
>>
>>     cmd param1 'param2 has spaces and a $variable'
>>
>>
>> action "cmd param1 'param2 has spaces and a '$variable";
>>
>> should do the trick. I'm documenting this now...
> 
> It worked!! Thanks!

Oooops, too fast.

I wrote this script:

#!/bin/sh

echo "Param1 = '${1}'" >> /root/log
echo "Param2 = '${2}'" >> /root/log

And added this action on devd config:

notify 0 {
         match "system"          "IFNET";
         match "type"            "LINK_UP";
         media-type              "ethernet";
	action "/root/log.sh -c 'interface linkup start '$subsystem";
};

notify 0 {
         match "system"          "IFNET";
	match "type"            "LINK_DOWN";
	media-type              "ethernet";
	action "/root/log.sh -c 'interface linkup stop '$subsystem";
};

And got the following output on /root/log:

Param1 = '-c'
Param2 = 'interface linkup start $em0'


More information about the svn-src-all mailing list