[systemd-devel] Udev rule from Yocto 1.8.1 no longer works in Yocto 2.2.2

2017-08-16 Thread Brian Hutchinson
Hi,

I have a case where I have basically a cold plugged USB based mass storage
device.

This is an embedded application, so I do some magic with udev rules (not
using systemd yet which would make this easier from what I hear) to make
sure the device has e2fsck ran on it before it mounts.

To make a long story short, I have one "add" rule that adds the device
symlink and sets a user environment variable (lets call it my_usb_storage).

Later when init is running, I have a rc.local script that runs e2fsck on
the device if the expected symlink is present (udev enumerated it as we
expected) and when fsck returns with a clean status, a udevadm trigger
event fires and I have a matching rule that tests user set environment
variable ENV{my_usb_storage}=="1".

This testing of a user set environment variable used to work but now it
doesn't.

In researching the problem, I stumbled on this email in the archives:

https://lists.freedesktop.org/archives/systemd-devel/2013-December/015707.html

... which clued me into maybe having to use a rule that does IMPORT{db}.
In trying to find info on IMPORT{db} I found the original commit of the
feature???

https://www.redhat.com/archives/lvm-devel/2010-April/msg00225.html

... which was done in 2010 but my udev from Yocto 1.8.1 is beyond udev 152
so don't know how I didn't run into this problem earlier.

So I still can't find any good examples or documentation on how to use
IMPORT{db} to get back the expected behavior I had before.

Ironnically my udevadm trigger that worked was also a "add" trigger and I
get the idea that I shouldn't have done that but I basically hacked the
standard mount.sh udev script to use with my special cold plugged device
and it won't mount unless it's a "add" even so that's why I did it.

Anybody know what I'm getting at here and how I can get my rules to work
again???

Thanks!

Regards,

Brian
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Mantas Mikulėnas
On Wed, Aug 16, 2017 at 1:09 PM, Reindl Harald 
wrote:

>
>
> Am 16.08.2017 um 12:04 schrieb Mantas Mikulėnas:
>
>> On Wed, Aug 16, 2017 at 12:09 PM, Reindl Harald > > wrote:
>>
>>
>> Am 16.08.2017 um 10:31 schrieb Mantas Mikulėnas:
>>
>> Just put everything in a shell script. (That way you can test it
>> directly without systemd, too.)
>>
>> With bash, you can use inline comments in arrays:
>>
>>  #!/usr/bin/env bash
>>  args=(
>>   -X POST # foo
>>   -d "fizz=systemd"   # some docs
>>   -d "some=else"  # more docs
>> https://requestb.in/foo
>>  )
>>
>>  exec curl "${args[@]}"
>>
>>
>> this is the worst recommendation one can give - really - that way
>> you easily lose all the advantages of systemd in case of error
>> handling
>>
>>
>> For example?
>>
>
> what is the MAINPID - bash or curl - in that case?
>

curl, since `exec` preserves the PID.

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Colin Guthrie
Kai Hendry wrote on 16/08/17 08:52:
> Hi there,
> 
> I maintain a service file with a lot of switches in the ExecStart
> https://github.com/kaihendry/pingprom/blob/master/prometheus%40.service#L8
> 
> I want to almost document each switch ... e.g.
> -storage.local.retention=8544h  # keep data for a year
> 
> I know inline comments do *not* work in bash IIUC:
> https://gist.github.com/kaihendry/ff751622c6454176837b1c340b5cfccb
> 
> And similarly when I try break up lines on something like
> https://s.natalian.org/2017-08-16/test.service
> 
> [Service]
> ExecStart=/usr/bin/curl -X POST 
> -d "fizz=systemd"  # some docs
> -d "some=else"  # more docs
>  https://requestb.in/19v8a0m1
> 
> 
> It also doesn't work. Am I missing a tool or way to better
> format/document process arguments like I want?
> 
> Many thanks!

Write a companion man page and/or web page and reference it in
Documentation=

Col


-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Mantas Mikulėnas
On Wed, Aug 16, 2017 at 12:09 PM, Reindl Harald 
wrote:

>
> Am 16.08.2017 um 10:31 schrieb Mantas Mikulėnas:
>
>> Just put everything in a shell script. (That way you can test it directly
>> without systemd, too.)
>>
>> With bash, you can use inline comments in arrays:
>>
>> #!/usr/bin/env bash
>> args=(
>>  -X POST # foo
>>  -d "fizz=systemd"   # some docs
>>  -d "some=else"  # more docs
>> https://requestb.in/foo
>> )
>>
>> exec curl "${args[@]}"
>>
>
> this is the worst recommendation one can give - really - that way you
> easily lose all the advantages of systemd in case of error handling


For example?

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Reindl Harald



Am 16.08.2017 um 12:04 schrieb Mantas Mikulėnas:
On Wed, Aug 16, 2017 at 12:09 PM, Reindl Harald > wrote:



Am 16.08.2017 um 10:31 schrieb Mantas Mikulėnas:

Just put everything in a shell script. (That way you can test it
directly without systemd, too.)

With bash, you can use inline comments in arrays:

 #!/usr/bin/env bash
 args=(
  -X POST # foo
  -d "fizz=systemd"   # some docs
  -d "some=else"  # more docs
https://requestb.in/foo
 )

 exec curl "${args[@]}"


this is the worst recommendation one can give - really - that way
you easily lose all the advantages of systemd in case of error handling


For example?


what is the MAINPID - bash or curl - in that case?

why inthe world should someone sacrifice the advantage of having the 
executebale directly started because of inline comments where a smart 
comments-block does the same


[Service]
ExecStart=/usr/bin/curl -X POST
-d "fizz=systemd"  # some docs
-d "some=else"  # more docs

versus

[Service]
# fizz: somedocs
# some: moredocs
ExecStart=/usr/bin/curl -X POST -d "fizz=systemd" -d "some=else"

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Reindl Harald


Am 16.08.2017 um 10:31 schrieb Mantas Mikulėnas:
Just put everything in a shell script. (That way you can test it 
directly without systemd, too.)


With bash, you can use inline comments in arrays:

#!/usr/bin/env bash
args=(
 -X POST # foo
 -d "fizz=systemd"   # some docs
 -d "some=else"  # more docs
https://requestb.in/foo
)

exec curl "${args[@]}"


this is the worst recommendation one can give - really - that way you 
easily lose all the advantages of systemd in case of error handling



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Jérémy Rosen



On 16/08/2017 10:31, Mantas Mikulėnas wrote:
On Wed, Aug 16, 2017 at 10:52 AM, Kai Hendry > wrote:


Hi there,

I maintain a service file with a lot of switches in the ExecStart
https://github.com/kaihendry/pingprom/blob/master/prometheus%40.service#L8


I want to almost document each switch ... e.g.
-storage.local.retention=8544h  # keep data for a year

I know inline comments do *not* work in bash IIUC:
https://gist.github.com/kaihendry/ff751622c6454176837b1c340b5cfccb


And similarly when I try break up lines on something like
https://s.natalian.org/2017-08-16/test.service


[Service]
ExecStart=/usr/bin/curl -X POST
-d "fizz=systemd"  # some docs
-d "some=else"  # more docs
https://requestb.in/19v8a0m1


It also doesn't work. Am I missing a tool or way to better
format/document process arguments like I want?


Just put everything in a shell script. (That way you can test it 
directly without systemd, too.)


Alternatively, you could documente everything in an EnvironmentFile that 
sets an environment variable with all the parameters and documents in a 
comment


Regards
Jérémy
--

With bash, you can use inline comments in arrays:

#!/usr/bin/env bash
args=(
-X POST # foo
-d "fizz=systemd"   # some docs
-d "some=else"  # more docs
https://requestb.in/foo
)

exec curl "${args[@]}"


--
Mantas Mikulėnas >



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


--
Logo 

20 rue des Jardins
92600 Asnières-sur-Seine
www.smile.fr    
*Jérémy ROSEN*
Architecte technique
Email : jeremy.ro...@smile.fr 
Tel : +33141402967

Facebook  Google%2B 
 LinkedIn 
 Twitter 




bandeaux_mail 



eco Pour la planète, n'imprimez ce mail que si c'est nécessaire
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Mantas Mikulėnas
On Wed, Aug 16, 2017 at 10:52 AM, Kai Hendry 
wrote:

> Hi there,
>
> I maintain a service file with a lot of switches in the ExecStart
> https://github.com/kaihendry/pingprom/blob/master/prometheus%40.service#L8
>
> I want to almost document each switch ... e.g.
> -storage.local.retention=8544h  # keep data for a year
>
> I know inline comments do *not* work in bash IIUC:
> https://gist.github.com/kaihendry/ff751622c6454176837b1c340b5cfccb
>
> And similarly when I try break up lines on something like
> https://s.natalian.org/2017-08-16/test.service
>
> [Service]
> ExecStart=/usr/bin/curl -X POST
> -d "fizz=systemd"  # some docs
> -d "some=else"  # more docs
>  https://requestb.in/19v8a0m1
>
>
> It also doesn't work. Am I missing a tool or way to better
> format/document process arguments like I want?
>

Just put everything in a shell script. (That way you can test it directly
without systemd, too.)

With bash, you can use inline comments in arrays:

#!/usr/bin/env bash
args=(
-X POST # foo
-d "fizz=systemd"   # some docs
-d "some=else"  # more docs
https://requestb.in/foo
)

exec curl "${args[@]}"


-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Formatting Execstart= for readability

2017-08-16 Thread Kai Hendry
Hi there,

I maintain a service file with a lot of switches in the ExecStart
https://github.com/kaihendry/pingprom/blob/master/prometheus%40.service#L8

I want to almost document each switch ... e.g.
-storage.local.retention=8544h  # keep data for a year

I know inline comments do *not* work in bash IIUC:
https://gist.github.com/kaihendry/ff751622c6454176837b1c340b5cfccb

And similarly when I try break up lines on something like
https://s.natalian.org/2017-08-16/test.service

[Service]
ExecStart=/usr/bin/curl -X POST 
-d "fizz=systemd"  # some docs
-d "some=else"  # more docs
 https://requestb.in/19v8a0m1


It also doesn't work. Am I missing a tool or way to better
format/document process arguments like I want?

Many thanks!
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel