[systemd-devel] [systemd.service] TCP listen port conflict resolution / explicit erring?

Manuel Amador (Rudd-O) rudd-o at rudd-o.com
Mon May 1 09:34:19 UTC 2017


On 05/01/2017 03:57 AM, Alec Taylor wrote:
> Wrote some scripts to generate systemd .service files and start-up
> those services.
>
> Currently just for some REST APIs, but soon will include distributed
> systems also.
>
> I set the TCP listen port variable that is used by my .service like
> so: `Environment=PORT=4200`
>
> To get PATH to work nicely, my `ExecStart` begins with:
> /bin/bash -c 'PATH=bash -c PATH=$PREPEND_PATH:$PATH
>
> (would appreciate an alternative to launching a new shell there also!)
>
> *Is there a systemd trick of explicitly erring on TCP listen-port
> conflicts?
>
> *
> And/or should I just write a parser that loops through all .service's
> and checks the `PORT=` and raises on conflict?

You are meant to use socket units for what you are doing.  Look it up.

-- 
    Rudd-O
    http://rudd-o.com/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170501/9922515b/attachment.sig>


More information about the systemd-devel mailing list