"best practices" getting AiP to write it's pid to /var/run/aip.pid

20 views
Skip to first unread message

Jeff Brown

unread,
Apr 12, 2014, 3:02:49 PM4/12/14
to aip-p...@googlegroups.com
We built an AiP server to handle a persistent connection to SAP.

Painful, but functionally quite awesome now that it's done.  

However the Systems guy says his life would be way better if AiP followed a "best practices" rule, and wrote it's pid to a a file, so it could be built into a more standard service,

e.g.

# service aip start|stop|restart

Is there a library and some setting for this?

A scan of the default code seems to say it's not a core functionality.

If I were to build a piece for this, where would be the best place architecturally to place it?

I know I could just hack it into:

AiP/Runner.php

But it seems like this should have a better home as some sort of class by itself, maybe configurable in the composer.json

Worst case, for my use we'll probably drop it in AiP/Runner.php unless we can find a better place for it to live.

Jeff



Alexey Zakhlestin

unread,
Apr 12, 2014, 5:28:54 PM4/12/14
to aip-p...@googlegroups.com

On 12 Apr 2014, at 23:02, Jeff Brown <jef...@gmail.com> wrote:

> We built an AiP server to handle a persistent connection to SAP.
>
> Painful, but functionally quite awesome now that it's done.
>
> However the Systems guy says his life would be way better if AiP followed a "best practices" rule, and wrote it's pid to a a file, so it could be built into a more standard service,
>
> e.g.
>
> # service aip start|stop|restart
>
> Is there a library and some setting for this?
>
> A scan of the default code seems to say it's not a core functionality.
>
> If I were to build a piece for this, where would be the best place architecturally to place it?
>
> I know I could just hack it into:
>
> AiP/Runner.php
>
> But it seems like this should have a better home as some sort of class by itself, maybe configurable in the composer.json

Well… I guess, that Runner actually is a proper place for this, but I wonder why you need this setting.
PID-files are useful, when server detaches itself from the parent process before starting to work. AiP does not detach.

So, if you need PID-files then there is a good chance that you also need AiP to detach itself.
Modern init-systems (systemd, upstart) can easily work with non-detaching services (and guess their PID automagically), but I understand that you might have other needs.

Can you open an issue at https://github.com/indeyets/appserver-in-php/issues ?
I’ll add this functionality

--
Alexey Zakhlestin
CTO at Grids.by/you
https://github.com/indeyets
PGP key: http://indeyets.ru/alexey.zakhlestin.pgp.asc



signature.asc
Reply all
Reply to author
Forward
0 new messages