Re: [systemd-devel] Antw: Re: Q: Implementing logrotate's postrotate with systemd

2019-06-11 Thread Michael Biebl
Am Di., 11. Juni 2019 um 16:18 Uhr schrieb Reindl Harald
:
>
>
>
> Am 11.06.19 um 15:00 schrieb Ulrich Windl:
>  Reindl Harald  schrieb am 11.06.2019 um 14:30 in
> > Nachricht <917331d8-845f-54d5-908c-e6c7d124a...@thelounge.net>:
> >>
> >> Am 11.06.19 um 13:34 schrieb Ulrich Windl:
> >>> I have a forking service (with a PID file) that can reopen the logfile 
> >>> after
> >> receiving SIGHUP. In the past I had implemented "rc{service} rotate" to 
> >> send
> >> SIGHUP to the daemon as "postrotate" action. After converting (actually 
> >> being
> >> converted ;-)) to systemd I dropped the LSB script, and wonder which 
> >> command
> >> to use as "postrotate" action:
> >>>
> >>> Should I implement a oneshot service (using "systemctl start {service}")
> >> that does depend on the actual service and send a SIGHUP on start, or is
> >> there a more elegent solution?
> >>
> >> that's what reload is all about
> >>
> >> [harry@srv-rhsoft:/etc/systemd/system]$ cat named.service | grep Reload
> >> ExecReload=/usr/bin/kill -HUP $MAINPID
> >
> > The manual page says it's about "configuration reload". I was talking about 
> > logfile rotation (my service does not suport configuration reload (other 
> > than restart))
>
> frankly it's nothing new or uncommon that services close and re-open
> their logfiles by "reload" and that's really not systemd specific,
> sysvinit had reload too
>
> it's you turn what happens with "systemctl reload yourservice" becaus
> ethere is no default action for that unless "ExecReload" is specified

Of course you can do whatever you please in ExecReload, but as said I
think it's good practice if "reload" has a certain consistent meaning
across services so admins not familiar with a particular service know
what to expect from "systemctl reload".

See also
https://github.com/rsyslog/rsyslog/commit/fd26a42bdc04eaf497cafd9ef806a54f3de1a7e9#diff-c64e6ed7f40ecd1530e093a77c9465f6



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Antw: Re: Q: Implementing logrotate's postrotate with systemd

2019-06-11 Thread Reindl Harald


Am 11.06.19 um 15:00 schrieb Ulrich Windl:
 Reindl Harald  schrieb am 11.06.2019 um 14:30 in
> Nachricht <917331d8-845f-54d5-908c-e6c7d124a...@thelounge.net>:
>>
>> Am 11.06.19 um 13:34 schrieb Ulrich Windl:
>>> I have a forking service (with a PID file) that can reopen the logfile 
>>> after 
>> receiving SIGHUP. In the past I had implemented "rc{service} rotate" to send 
>> SIGHUP to the daemon as "postrotate" action. After converting (actually 
>> being 
>> converted ;-)) to systemd I dropped the LSB script, and wonder which command 
>> to use as "postrotate" action:
>>>
>>> Should I implement a oneshot service (using "systemctl start {service}") 
>> that does depend on the actual service and send a SIGHUP on start, or is 
>> there a more elegent solution?
>>
>> that's what reload is all about
>>
>> [harry@srv-rhsoft:/etc/systemd/system]$ cat named.service | grep Reload
>> ExecReload=/usr/bin/kill -HUP $MAINPID
> 
> The manual page says it's about "configuration reload". I was talking about 
> logfile rotation (my service does not suport configuration reload (other than 
> restart))

frankly it's nothing new or uncommon that services close and re-open
their logfiles by "reload" and that's really not systemd specific,
sysvinit had reload too

it's you turn what happens with "systemctl reload yourservice" becaus
ethere is no default action for that unless "ExecReload" is specified
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Antw: Re: Q: Implementing logrotate's postrotate with systemd

2019-06-11 Thread Michael Biebl
Am Di., 11. Juni 2019 um 15:00 Uhr schrieb Ulrich Windl
:
>
> >>> Reindl Harald  schrieb am 11.06.2019 um 14:30 in
> Nachricht <917331d8-845f-54d5-908c-e6c7d124a...@thelounge.net>:
>
> >
> > Am 11.06.19 um 13:34 schrieb Ulrich Windl:
> >> I have a forking service (with a PID file) that can reopen the logfile 
> >> after
> > receiving SIGHUP. In the past I had implemented "rc{service} rotate" to send
> > SIGHUP to the daemon as "postrotate" action. After converting (actually 
> > being
> > converted ;-)) to systemd I dropped the LSB script, and wonder which command
> > to use as "postrotate" action:
> >>
> >> Should I implement a oneshot service (using "systemctl start {service}")
> > that does depend on the actual service and send a SIGHUP on start, or is
> > there a more elegent solution?
> >
> > that's what reload is all about
> >
> > [harry@srv-rhsoft:/etc/systemd/system]$ cat named.service | grep Reload
> > ExecReload=/usr/bin/kill -HUP $MAINPID
>
> The manual page says it's about "configuration reload". I was talking about 
> logfile rotation (my service does not suport configuration reload (other than 
> restart)).

Right, I wouldn't use ExecReload= for this use case myself.
If I run "systemctl reload $service", I expect that the service
reloads its configuration and I think it's good practice to be
consistent in that matter and not overload ExecReload= with "rotate
log files".


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Antw: Re: Q: Implementing logrotate's postrotate with systemd

2019-06-11 Thread Ulrich Windl
>>> Reindl Harald  schrieb am 11.06.2019 um 14:30 in
Nachricht <917331d8-845f-54d5-908c-e6c7d124a...@thelounge.net>:

> 
> Am 11.06.19 um 13:34 schrieb Ulrich Windl:
>> I have a forking service (with a PID file) that can reopen the logfile after 
> receiving SIGHUP. In the past I had implemented "rc{service} rotate" to send 
> SIGHUP to the daemon as "postrotate" action. After converting (actually being 
> converted ;-)) to systemd I dropped the LSB script, and wonder which command 
> to use as "postrotate" action:
>> 
>> Should I implement a oneshot service (using "systemctl start {service}") 
> that does depend on the actual service and send a SIGHUP on start, or is 
> there a more elegent solution?
> 
> that's what reload is all about
> 
> [harry@srv-rhsoft:/etc/systemd/system]$ cat named.service | grep Reload
> ExecReload=/usr/bin/kill -HUP $MAINPID

The manual page says it's about "configuration reload". I was talking about 
logfile rotation (my service does not suport configuration reload (other than 
restart)).

> 
> [harry@srv-rhsoft:/etc/systemd/system]$ cat rsyslog.service | grep Reload
> ExecReload=/usr/bin/kill -HUP $MAINPID
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org 
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel 




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

[systemd-devel] Antw: Re: Q: Implementing logrotate's postrotate with systemd

2019-06-11 Thread Ulrich Windl
>>> Michael Biebl  schrieb am 11.06.2019 um 14:13 in Nachricht
:
> A separate oneshot service sounds like overkill. I would probably use
> something like
> `systemctl kill -s HUP ${service}.service`
> If your sevices spawns multiple processes and you only want to send
> SIGHUP to the main process, you should add a `--kill-who=main`

Thanks! I wasn't aware of systemctl's "kill".

Regards,
Ulrich

> 
> All documented nicely in
> https://www.freedesktop.org/software/systemd/man/systemctl.html 
> 
> Am Di., 11. Juni 2019 um 13:34 Uhr schrieb Ulrich Windl
> :
>>
>> Hi!
>>
>> I have a forking service (with a PID file) that can reopen the logfile after 
> receiving SIGHUP. In the past I had implemented "rc{service} rotate" to send 
> SIGHUP to the daemon as "postrotate" action. After converting (actually being 
> converted ;-)) to systemd I dropped the LSB script, and wonder which command 
> to use as "postrotate" action:
>>
>> Should I implement a oneshot service (using "systemctl start {service}") 
> that does depend on the actual service and send a SIGHUP on start, or is 
> there a more elegent solution?
>>
>> Regards,
>> Ulrich
>>
>>
>>
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org 
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel 
> 
> 
> 
> -- 
> Why is it that all of the instruments seeking intelligent life in the
> universe are pointed away from Earth?
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org 
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel 




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