-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- needs a single executable for service command
- Loading branch information
Showing
3 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
|
||
SERVICE_COMMAND="${SYNOPKG_PKGDEST}/bin/ympd -w ${SERVICE_PORT}" | ||
SVC_BACKGROUND=y | ||
SVC_WRITE_PID=y | ||
# pass variables by env | ||
export PID_FILE=${PID_FILE} | ||
export SERVICE_PORT=${SERVICE_PORT} | ||
export SYNOPKG_PKGDEST=${SYNOPKG_PKGDEST} | ||
|
||
SERVICE_COMMAND="${SYNOPKG_PKGDEST}/bin/start.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
# we need a single file to start the service and create the pid-file | ||
# the combination of | ||
# - SVC_BACKGROUND=y | ||
# - SVC_WRITE_PID=y | ||
# does not work in DSM 5 when SERVICE_COMMAND is a command with parameters. | ||
# On DSM 5 /bin/sh is ash and not bash and '/bin/sh -c "command parameter" &' will create a new process for "command parameter" | ||
# finally we have two processes in the background, but are not able to retrieve the PID of "command parameter" | ||
# | ||
|
||
if [ -z "${SYNOPKG_PKGDEST}" -o -z "${PID_FILE}" -o -z "${SERVICE_PORT}" ]; then | ||
echo "ERROR: SYNOPKG_PKGDEST, PID_FILE or SERVICE_PORT is not defined. This script must be run in the context of DSM service command." | ||
exit 1 | ||
fi | ||
|
||
${SYNOPKG_PKGDEST}/bin/ympd -w ${SERVICE_PORT} | ||
echo "$!" > ${PID_FILE} | ||
|