mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 03:19:05 +02:00
Modified launch daemon Tentacle script to use configuration file
This commit is contained in:
parent
0699f261ad
commit
4bc10e503b
@ -9,7 +9,7 @@
|
|||||||
addresses 0.0.0.0
|
addresses 0.0.0.0
|
||||||
|
|
||||||
# [-p] Port to listen on
|
# [-p] Port to listen on
|
||||||
# port 41121
|
port 41121
|
||||||
|
|
||||||
# [-c] Maximum number of simultaneous connections
|
# [-c] Maximum number of simultaneous connections
|
||||||
# max_connections 10
|
# max_connections 10
|
||||||
@ -54,7 +54,7 @@ directory /var/spool/pandora/data_in
|
|||||||
# verbose 0
|
# verbose 0
|
||||||
|
|
||||||
# [-l] Log file
|
# [-l] Log file
|
||||||
# log_file /path/to/log/file
|
log_file /dev/null
|
||||||
|
|
||||||
# [-x] Server password
|
# [-x] Server password
|
||||||
# password PASSWORD
|
# password PASSWORD
|
||||||
|
@ -57,7 +57,7 @@ function get_pid {
|
|||||||
# in a "strech" term, ps aux don't report more than COLUMNS
|
# in a "strech" term, ps aux don't report more than COLUMNS
|
||||||
# characters and this will not work.
|
# characters and this will not work.
|
||||||
COLUMNS=300
|
COLUMNS=300
|
||||||
TENTACLE_PID=`ps -Af | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep "$TENTACLE_PORT" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
TENTACLE_PID=`ps -Af | grep "$TENTACLE_PATH$TENTACLE_DAEMON" | grep "$TENTACLE_CONFIG_FILE" | grep -v grep | tail -1 | awk '{ print $2 }'`
|
||||||
echo $TENTACLE_PID
|
echo $TENTACLE_PID
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,18 +71,12 @@ function get_all_pid {
|
|||||||
echo $TENTACLE_PID
|
echo $TENTACLE_PID
|
||||||
}
|
}
|
||||||
|
|
||||||
# Pandora server settings
|
|
||||||
PANDORA_SERVER_PATH="/var/spool/pandora/data_in"
|
|
||||||
|
|
||||||
# Tentacle server settings
|
# Tentacle server settings
|
||||||
TENTACLE_DAEMON="tentacle_server"
|
TENTACLE_DAEMON="tentacle_server"
|
||||||
TENTACLE_PATH="/usr/bin"
|
TENTACLE_PATH="/usr/bin"
|
||||||
TENTACLE_USER="pandora"
|
TENTACLE_USER="pandora"
|
||||||
|
TENTACLE_CONFIG_FILE="/etc/tentacle/tentacle_server.conf"
|
||||||
TENTACLE_ADDR="0.0.0.0"
|
TENTACLE_EXT_OPTS=""
|
||||||
TENTACLE_PORT="41121"
|
|
||||||
TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.lock:trans"
|
|
||||||
TENTACLE_LOG_FILE="/dev/null"
|
|
||||||
|
|
||||||
# Set umask to 0002, because group MUST have access to write files to
|
# Set umask to 0002, because group MUST have access to write files to
|
||||||
# use remote file management on Pandora FMS Enterprise.
|
# use remote file management on Pandora FMS Enterprise.
|
||||||
@ -90,7 +84,7 @@ TENTACLE_LOG_FILE="/dev/null"
|
|||||||
umask 0007
|
umask 0007
|
||||||
|
|
||||||
# Main script
|
# Main script
|
||||||
TENTACLE_OPTS="-a $TENTACLE_ADDR -p $TENTACLE_PORT -s $PANDORA_SERVER_PATH $TENTACLE_EXT_OPTS -d -l $TENTACLE_LOG_FILE -v"
|
TENTACLE_OPTS="-F $TENTACLE_CONFIG_FILE $TENTACLE_EXT_OPTS"
|
||||||
|
|
||||||
# Fix TENTACLE_PATH
|
# Fix TENTACLE_PATH
|
||||||
case "$TENTACLE_PATH" in
|
case "$TENTACLE_PATH" in
|
||||||
@ -114,7 +108,15 @@ case "$1" in
|
|||||||
echo "Tentacle Server is already running with PID $TENTACLE_PID"
|
echo "Tentacle Server is already running with PID $TENTACLE_PID"
|
||||||
rc_exit # running start on a service already running
|
rc_exit # running start on a service already running
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Try to change the privileges of configuration file
|
||||||
|
chown $TENTACLE_USER $TENTACLE_CONFIG_FILE > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Cannot change the owner of $TENTACLE_CONFIG_FILE configuration file to $TENTACLE_USER user."
|
||||||
|
rc_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Init the tentacle process
|
||||||
sudo -u $TENTACLE_USER ${TENTACLE_PATH}$TENTACLE_DAEMON $TENTACLE_OPTS
|
sudo -u $TENTACLE_USER ${TENTACLE_PATH}$TENTACLE_DAEMON $TENTACLE_OPTS
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
@ -124,7 +126,7 @@ case "$1" in
|
|||||||
rc_status -v
|
rc_status -v
|
||||||
else
|
else
|
||||||
echo "Tentacle Server could not be started."
|
echo "Tentacle Server could not be started."
|
||||||
echo "Verify that port $TENTACLE_PORT is not used."
|
echo "Verify that Tentacle port is not used."
|
||||||
rc_failed 7 # program not running
|
rc_failed 7 # program not running
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ After=network-online.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart=/usr/bin/tentacle_server -a 0.0.0.0 -p 41121 -s /var/spool/pandora/data_in -i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections -d
|
ExecStart=/usr/bin/tentacle_server -F /etc/tentacle/tentacle_server.conf
|
||||||
User=pandora
|
User=pandora
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user