Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Added support for systemd-based services #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bb233
Copy link

@bb233 bb233 commented Apr 10, 2018

I modified/rewrote the services tool to handle both upstart and systemd based systems. I tried to keep existing behavior (especially regarding fallbacks for 1.5-style installs), but I have no way to test that.

@mamedin mamedin self-assigned this Apr 16, 2018
@mamedin mamedin self-requested a review April 16, 2018 19:56
@mamedin mamedin added the Status: review The issue has been merged and is ready for review. Waffle label. label Aug 13, 2018
echo "storage_service $ACTION did not work"
}
}
# detect if upstart/systemd/sysvinit
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the other script comments, I think you should remove the initial blank space after #

INITSYS="sysvinit" # unlikely
fi

# detect if 1.5 style deployment
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the other script comments, I think you should remove the initial blank space after #

@mamedin
Copy link

mamedin commented Aug 15, 2018

Hi Buddha, nice work!

I tested on Ubuntu14 (systemV), Ubuntu16 (systemd) and CentOS 7 (systemd). I suggested some cosmetic changes and a typo fix.

At last, when testing CentOS I noticed that the initial scripts doesn't take account of some different service names for CentOS/Red Hat (clamavd and gearmand).

This is the diff I used to test this PR:

diff --git a/tools/services b/tools/services
index 47ea72c..7ee078d 100644
--- a/tools/services
+++ b/tools/services
@@ -19,7 +19,7 @@
 
 function detect_deployment()
 {
-    # detect if upstart/systemd/sysvinit
+    #detect if upstart/systemd/sysvinit
     if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then
        INITSYS="upstart";
     elif [[ `systemctl` =~ -\.mount ]]; then
@@ -28,7 +28,7 @@ function detect_deployment()
        INITSYS="sysvinit" # unlikely
     fi
 
-  # detect if 1.5 style deployment
+    #detect if 1.5 style deployment
     if [[ `grep "VERSION = (1, 5" /usr/lib/archivematica/archivematicaCommon/version.py` ]]; then
        INITSYS="1.5";
     fi
@@ -48,7 +48,7 @@ function dashboard()
 {
     case $INITSYS in
        upstart) sudo $ACTION archivematica-dashboard;;
-       systemd) sudo systemctl $ACTION archivematica-storage-service;;
+       systemd) sudo systemctl $ACTION archivematica-dashboard;;
        1.5)     sudo service apache2 $ACTION;;
     esac
 }    
@@ -74,16 +74,16 @@ function full()
     #handle all services, not just am specific ones
     case $INITSYS in
        upstart|1.5)
-           sudo service gearman-job-server "$ACTION"
+           sudo service "$GEARMAN_DAEMON" "$ACTION"
            sudo "$ACTION" fits
-           sudo service clamav-daemon "$ACTION"
+           sudo service "$CLAMAV_DAEMON" "$ACTION"
            sudo service elasticsearch "$ACTION"
            sudo service nginx "$ACTION"
            ;;
        systemd)
-           sudo systemctl $ACTION gearmand
+           sudo systemctl $ACTION "$GEARMAN_DAEMON"
            sudo systemctl $ACTION fits-nailgun
-           sudo systemctl $ACTION clamd
+           sudo systemctl $ACTION "$CLAMAV_DAEMON"
            sudo systemctl $ACTION nginx
            ;;
     esac
@@ -100,8 +100,15 @@ function full()
 detect_deployment
 
 #defaults
+GEARMAN_DAEMON="gearman-job-server"
+CLAMAV_DAEMON="clamav-daemon"
 ACTION="restart"
 LEVEL="basic"
+#change the services names for CentOS/Red Hat
+if [ -f /etc/redhat-release ] ; then
+    GEARMAN_DAEMON="gearmand"
+    CLAMAV_DAEMON="clamd@scan"
+fi
 #look for user supplied parameters
 {
     [ $# -gt 0 ] && ACTION=$1

if you think this last change I'm proposing is out of scope, I can add it as a separate PR.

Thanks very much :D

@sromkey sromkey added Status: in progress Issue that is currently being worked on. Waffle label. and removed Status: review The issue has been merged and is ready for review. Waffle label. labels Sep 26, 2018
@sromkey
Copy link
Contributor

sromkey commented Sep 26, 2018

Hi @bb233 , it's been a little while but if you're interested in continuing the process, we'll get you to sign a contributor's agreement: https://github.com/artefactual/archivematica/blob/stable/1.7.x/CONTRIBUTING.md#contributors-agreement and you could take a look at @mamedin 's feedback? Thanks so much for your interest!

@bb233
Copy link
Author

bb233 commented Sep 26, 2018

Hi @sromkey

I believe you have a contributor's agreement on file for me; I sent a signed agreement to agreement@artifactual.com back in April, a week before creating this pull request.

I briefly looked at @mamedin's feedback, and it looked good. I haven't had the free time here to do more about it. I will try to move this along this weekend.

@sromkey
Copy link
Contributor

sromkey commented Sep 27, 2018

@bb233 you're right, I found it! Sorry about that.

No rush from our perspective, we just wanted to let you know we weren't ignoring it :)

@nickwilkinson nickwilkinson modified the milestone: 1.9.0 Oct 1, 2018
@nickwilkinson nickwilkinson added Status: refining The issue needs additional details to ensure that requirements are clear. Waffle label. and removed Status: in progress Issue that is currently being worked on. Waffle label. labels Oct 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: refining The issue needs additional details to ensure that requirements are clear. Waffle label.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants