Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 2020 15:20:46 -0300
From:      Renato Botelho <garga@FreeBSD.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r366578 - head/sbin/devd
Message-ID:  <563930e3-19ec-44dd-fd6f-1d55859d9235@FreeBSD.org>
In-Reply-To: <2f49af1f-f0fb-f5f0-82bf-8b46ead027c1@FreeBSD.org>
References:  <202010091529.099FT6Ab049635@repo.freebsd.org> <af6500af-0a96-1200-0c6e-34df212fcd7e@FreeBSD.org> <CANCZdfq9cvbaRoAc8Cd7czrF2ur8GKNSeCqchCe5=iBtRL1Fow@mail.gmail.com> <2f49af1f-f0fb-f5f0-82bf-8b46ead027c1@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@freebsd.org 
>> <mailto:garga@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'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?563930e3-19ec-44dd-fd6f-1d55859d9235>