%PDF- %PDF-
| Direktori : /opt/bitnami/scripts/init/ |
| Current File : /opt/bitnami/scripts/init/bitnami_agent |
#!/bin/sh
#
# Bitnami Agent
# Copyright 2020 Bitnami.com All Rights Reserved
#
. /opt/bitnami/scripts/init/functions
# start the monitoring agent if it is present
if [ -f /opt/bitnami/bnagent/bin/bnagent.bin ] ; then
/opt/bitnami/bnagent/bin/bnagent.bin -D --run
fi
BITNAMI_USER="bitnami"
# when run with --force option, run agent regardless of flag file
if [ "x$1" != "x--force" ] ; then
run_once_check "bitnami_agent"
if [ $? -ne 0 ]; then
exit 0
fi
fi
MINUTE=`date '+%M'`
if [ -f "/opt/bitnami/properties.ini" ]; then
chmod 770 /opt/bitnami/properties.ini
chown bitnami:root /opt/bitnami/properties.ini
fi
if [ -f "/home/bitnami/change-password.sh" ]; then
mv /home/bitnami/change-password.sh /home/bitnami/change-password-backup.sh
fi
sed -i '/generated by/d' /opt/bitnami/stats/agent.conf
sed -i '/installation_guid/d' /opt/bitnami/stats/agent.conf
su -l "$BITNAMI_USER" -c 'cd /opt/bitnami/stats && ./agent.bin --run -D'
if [ -f "/home/bitnami/change-password-backup.sh" ]; then
mv /home/bitnami/change-password-backup.sh /home/bitnami/change-password.sh
fi
sed -i '/agent\.bin/d' /etc/crontab
echo "$MINUTE * * * * $BITNAMI_USER cd /opt/bitnami/stats && ./agent.bin --run -D" >> /etc/crontab