You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2022/03/11 15:33:21 UTC
[trafficcontrol] branch master updated: Modify TP init script to be systemd compliant (#6636)
This is an automated email from the ASF dual-hosted git repository.
zrhoffman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 1fc8d0a Modify TP init script to be systemd compliant (#6636)
1fc8d0a is described below
commit 1fc8d0ae0ec370ecd7d6aeb521a54ea76be905c6
Author: Steve Hamrick <sh...@users.noreply.github.com>
AuthorDate: Fri Mar 11 08:33:06 2022 -0700
Modify TP init script to be systemd compliant (#6636)
* modify TP init script to be LSB-complaint
* Code review feedback
---
traffic_portal/build/etc/init.d/traffic_portal | 27 +++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/traffic_portal/build/etc/init.d/traffic_portal b/traffic_portal/build/etc/init.d/traffic_portal
index fb8991d..483c7e9 100755
--- a/traffic_portal/build/etc/init.d/traffic_portal
+++ b/traffic_portal/build/etc/init.d/traffic_portal
@@ -1,13 +1,29 @@
#!/bin/bash
#
# An init.d script for running a Node.js process as a service using PM2 as
-# the process monitor. For more configuration options associated with PM2,
-# see: https://github.com/
+# the process monitor.
#
# This was written for Debian distributions such as Ubuntu, but should still
# work on RedHat, Fedora, or other RPM-based distributions, since none of the
# built-in service functions are used. So information is provided for both.
#
+### BEGIN INIT INFO
+# Provides: traffic-portal
+# Required-Start: $syslog $remote_fs
+# Required-Stop: $syslog $remote_fs
+# Should-Start: $local_fs
+# Should-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Traffic Portal
+# Description: Traffic Portal
+### END INIT INFO
+#
+### BEGIN CHKCONFIG INFO
+# chkconfig: 2345 55 25
+# description: Traffic Portal
+### END CHKCONFIG INFO
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -36,6 +52,7 @@ RESTART_TIME="2000"
PATH=$PM2_BIN_DIR:$NODE_BIN_DIR:$PATH
export NODE_PATH=$NODE_PATH
+set -o pipefail
start() {
echo "Starting $NAME"
@@ -46,14 +63,14 @@ start() {
-l $LOGFILE \
--restart-delay $RESTART_TIME \
--time \
- --name "$NAME"
+ --name "$NAME" > /dev/null 2>&1
RETVAL=$?
}
stop() {
if pm2 list | grep -q "$NAME"; then
echo "Shutting down $NAME"
- pm2 stop $APPLICATION_PATH
+ pm2 stop $APPLICATION_PATH > /dev/null 2>&1
RETVAL=$?
else
echo "$NAME is not running."
@@ -86,7 +103,7 @@ case "$1" in
status)
status
;;
- restart)
+ restart | force-reload)
restart
;;
*)