[systemd-devel] Formatting Execstart= for readability
Mantas Mikulėnas
grawity at gmail.com
Wed Aug 16 08:31:00 UTC 2017
On Wed, Aug 16, 2017 at 10:52 AM, Kai Hendry <hendry at webconverger.com>
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 <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170816/454960ab/attachment.html>
More information about the systemd-devel
mailing list