-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·67 lines (60 loc) · 1.66 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·67 lines (60 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash -e
# =====================================================================
# Build script running OpenNMS Remote Poller in Docker environment
#
# Source: https://github.com/opennms-forge/docker-remote-poller
# Web: https://www.opennms.org
#
# =====================================================================
REMOTE_POLLER_HOME="/opt/opennms"
# Error codes
E_ILLEGAL_ARGS=126
# Help function used in error messages and -h option
usage() {
echo ""
echo "Docker entry script for OpenNMS Remote Poller service container"
echo ""
echo "-f: Initialize and start OpenNMS Minion in foreground and use configuration from environment."
echo "-h: Show this help."
echo ""
}
start() {
cd ${REMOTE_POLLER_HOME}/bin
java ${REMOTE_POLLER_JVM_ARGS} \
-Djava.rmi.activation.port="${REMOTE_POLLER_RMI_PORT}" \
-Djava.awt.headless=true -Djava.rmi.activation.port="${REMOTE_POLLER_RMI_PORT}" \
-jar remote-poller.jar \
--url=${REMOTE_POLLER_URI} \
--location=${REMOTE_POLLER_LOCATION} \
-n ${REMOTE_POLLER_USERNAME} \
-p ${REMOTE_POLLER_PASSWORD}
}
# Evaluate arguments for build script.
if [[ "${#}" == 0 ]]; then
usage
exit ${E_ILLEGAL_ARGS}
fi
# Evaluate arguments for build script.
while getopts fh flag; do
case ${flag} in
f)
start
;;
h)
usage
exit
;;
*)
usage
exit ${E_ILLEGAL_ARGS}
;;
esac
done
# Strip of all remaining arguments
shift $((OPTIND - 1));
# Check if there are remaining arguments
if [[ "${#}" > 0 ]]; then
echo "Error: To many arguments: ${*}."
usage
exit ${E_ILLEGAL_ARGS}
fi