Re: C API for service management

2016-01-20 Thread Jan Olszak
Cool, thanks!

On Tue, Jan 19, 2016 at 8:34 PM, Laurent Bercot  wrote:

> On 19/01/2016 18:44, Jan Olszak wrote:
>
>> Hi!
>> I'm developing a daemon that will:
>> - start/stop
>> - send signals
>> - check status
>> of some services.
>>
>> This can be done via s6-svc or s6-svstat but:
>> 1. Can I use the underlying calls from libs6?
>> 2. Is this interface likely to change?
>>
>
>  If you mean send commands to s6-supervise via s6_svc_writectl(),
> and read the status file via s6_svstatus_read(), then yes, you can use
> those calls, and no, it's probably not going to change.
>
>  The contents of a s6_svstatus_t structure, however, may be expanded in
> the future. I think you can rely on backwards compatibility, i.e. all
> the current fields will remain there with the same meaning; but do not
> assume that they are no other fields.
>
> --
>  Laurent
>
>


C API for service management

2016-01-19 Thread Jan Olszak
Hi!
I'm developing a daemon that will:
- start/stop
- send signals
- check status
of some services.

This can be done via s6-svc or s6-svstat but:
1. Can I use the underlying calls from libs6?
2. Is this interface likely to change?

Thanks,
Jan


Re: C API for service management

2016-01-19 Thread Laurent Bercot

On 19/01/2016 18:44, Jan Olszak wrote:

Hi!
I'm developing a daemon that will:
- start/stop
- send signals
- check status
of some services.

This can be done via s6-svc or s6-svstat but:
1. Can I use the underlying calls from libs6?
2. Is this interface likely to change?


 If you mean send commands to s6-supervise via s6_svc_writectl(),
and read the status file via s6_svstatus_read(), then yes, you can use
those calls, and no, it's probably not going to change.

 The contents of a s6_svstatus_t structure, however, may be expanded in
the future. I think you can rely on backwards compatibility, i.e. all
the current fields will remain there with the same meaning; but do not
assume that they are no other fields.

--
 Laurent



Re: C API for service management

2016-01-19 Thread Steve Litt
On Tue, 19 Jan 2016 18:44:54 +0100
Jan Olszak  wrote:

> Hi!
> I'm developing a daemon that will:
> - start/stop
> - send signals
> - check status
> of some services.
> 
> This can be done via s6-svc or s6-svstat but:
> 1. Can I use the underlying calls from libs6?
> 2. Is this interface likely to change?

I use runit, but as I remember from the little s6 that I did, s6 is
functionally speaking a superset of runit.

If I were going to develop a daemon like you suggest, I'd just use the
executables bestowed by the process supervisor. For instance:

Start = sv up servicename
stop = sv down servicename
restart = sv down servicename;sv up servicename
status check = sv status servicename

The output of sv status can be parsed to get whether it's running, and
if so its PID so you can use kill to send it the desired signal.

Why can't your daemon be a simple shellscript?

SteveT

Steve Litt 
January 2016 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28