Bug 24991 - make restart sip start sip if it isn't running
Summary: make restart sip start sip if it isn't running
Status: RESOLVED DUPLICATE of bug 30684
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Liz Rea
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-26 15:08 UTC by Liz Rea
Modified: 2022-08-18 08:20 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 24991: make koha-sip --restart start sip if it is not already running. (1.86 KB, patch)
2020-03-26 15:18 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24991: make koha-sip --restart start sip if it is not already running. (1.86 KB, patch)
2021-05-06 19:03 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24991: make koha-sip --restart start sip if it is not already running. (1.91 KB, patch)
2022-01-25 16:05 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 24991: make koha-sip --restart start sip if it is not already running. (1.91 KB, patch)
2022-02-02 09:06 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24991: Define noLF for the else block as well (868 bytes, patch)
2022-02-02 09:06 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Liz Rea 2020-03-26 15:08:16 UTC
koha-sip --restart should try to start sip if it is not running.
Comment 1 Liz Rea 2020-03-26 15:18:55 UTC
Created attachment 101874 [details] [review]
Bug 24991: make koha-sip --restart start sip if it is not already running.

To test:

- make sure SIP is enabled
 sudo koha-sip --enable inst
- make sure SIP is running
 sudo koha-sip --start inst
 sudo koha-sip --status inst
- restart SIP, make sure it does this normally
 sudo koha-sip --restart inst
- stop SIP, make sure it does this normally
 sudo koha-sip --stop inst
- make sure SIP is not running (wild scenario: oomkiller or similar has killed this or some other thing has happened)
 sudo koha-sip --status inst
- restart sip, make sure it starts SIP instead of silently failing
 sudo koha-sip --restart inst
- check SIP is now running, or that there is an error message if it can't start
 sudo koha-sip --status inst
Comment 2 Magnus Enger 2020-05-11 08:31:31 UTC
I think this needs to be updated after bug 24993 got pushed?
Comment 3 Liz Rea 2021-05-06 19:03:43 UTC
Created attachment 120638 [details] [review]
Bug 24991: make koha-sip --restart start sip if it is not already running.

To test:

- make sure SIP is enabled
 sudo koha-sip --enable inst
- make sure SIP is running
 sudo koha-sip --start inst
 sudo koha-sip --status inst
- restart SIP, make sure it does this normally
 sudo koha-sip --restart inst
- stop SIP, make sure it does this normally
 sudo koha-sip --stop inst
- make sure SIP is not running (wild scenario: oomkiller or similar has killed this or some other thing has happened)
 sudo koha-sip --status inst
- restart sip, make sure it starts SIP instead of silently failing
 sudo koha-sip --restart inst
- check SIP is now running, or that there is an error message if it can't start
 sudo koha-sip --status inst
Comment 4 Owen Leonard 2022-01-25 16:05:28 UTC
Created attachment 129807 [details] [review]
Bug 24991: make koha-sip --restart start sip if it is not already running.

To test:

- make sure SIP is enabled
 sudo koha-sip --enable inst
- make sure SIP is running
 sudo koha-sip --start inst
 sudo koha-sip --status inst
- restart SIP, make sure it does this normally
 sudo koha-sip --restart inst
- stop SIP, make sure it does this normally
 sudo koha-sip --stop inst
- make sure SIP is not running (wild scenario: oomkiller or similar has
  killed this or some other thing has happened)
 sudo koha-sip --status inst
- restart sip, make sure it starts SIP instead of silently failing
 sudo koha-sip --restart inst
- check SIP is now running, or that there is an error message if it
  can't start
 sudo koha-sip --status inst

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Jonathan Druart 2022-02-02 09:02:46 UTC
This patch looks trivial, but it's not.

1. There is blank line if restart called and sip is stopped. I will fix.

2. There is no consistency on --restart behaviour for debian scripts. Some stop && start, others don't start if was stopped. Not considering blocker but noting it.

3. Wondering if we won't hit the same problem as bug 24993, but for the start command:

170         if [ "$verbose" != "no" ]; then                                                               
171             log_daemon_msg "Warning: SIP server not running for ${name}... trying to start"           
172             log_end_msg 0                                                                             
173         fi                                                                                            
174         if is_sip_running ${name}; then                                                               
175             return 0                                                                                  
176         else      

We may not return 0 here if the startup was slow.

Do you have this patch applied on production servers?
Comment 6 Jonathan Druart 2022-02-02 09:05:26 UTC
% koha-sip --stop kohadev
$ koha-sip --verbose --restart kohadev 
Starting SIP server for kohadev:.
Warning: SIP server not running for kohadev... trying to start:.

Not sure this is the best we can do.
Comment 7 Jonathan Druart 2022-02-02 09:06:32 UTC
Created attachment 130059 [details] [review]
Bug 24991: make koha-sip --restart start sip if it is not already running.

To test:

- make sure SIP is enabled
 sudo koha-sip --enable inst
- make sure SIP is running
 sudo koha-sip --start inst
 sudo koha-sip --status inst
- restart SIP, make sure it does this normally
 sudo koha-sip --restart inst
- stop SIP, make sure it does this normally
 sudo koha-sip --stop inst
- make sure SIP is not running (wild scenario: oomkiller or similar has
  killed this or some other thing has happened)
 sudo koha-sip --status inst
- restart sip, make sure it starts SIP instead of silently failing
 sudo koha-sip --restart inst
- check SIP is now running, or that there is an error message if it
  can't start
 sudo koha-sip --status inst

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

JD Amended patch: tidy the whole block
Comment 8 Jonathan Druart 2022-02-02 09:06:36 UTC
Created attachment 130060 [details] [review]
Bug 24991: Define noLF for the else block as well

An empty line was displayed if --restart was called after --stop
Comment 9 Marcel de Rooy 2022-03-25 09:33:00 UTC
I think that it is inconsistent to check if SIP started in the else block while we are not doing the same for the IF block.

We could move a part of the else block AFTER the end if in order to always check if SIP started. Or just not check like we did?
Comment 10 Jonathan Druart 2022-08-18 08:20:04 UTC
We will see if bug 30684 fixes this one properly or if we will need to follow-up later.

*** This bug has been marked as a duplicate of bug 30684 ***