-
Notifications
You must be signed in to change notification settings - Fork 8
Added support for systemd-based services #55
base: master
Are you sure you want to change the base?
Conversation
echo "storage_service $ACTION did not work" | ||
} | ||
} | ||
# detect if upstart/systemd/sysvinit |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 #
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 |
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! |
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. |
@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 :) |
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.