Last active
January 1, 2016 05:29
-
-
Save shao1555/8098541 to your computer and use it in GitHub Desktop.
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
# Ubuntu upstart file at /etc/init/backup-agent.conf | |
description "MongoDB Monitoring Service (MMS) Backup Agent" | |
setuid nobody | |
setgid nogroup | |
pre-start script | |
if grep -q '@API_KEY@' /opt/backup-agent/local.config | |
then | |
logger -is -t "$UPSTART_JOB" "ERROR: api key not set in local.config!" | |
stop ; exit 1 | |
fi | |
end script | |
post-stop script | |
echo "$(date +'%Y-%m-%d %T,000') INFO backup-agent stopped" >> /var/log/backup-agent/agent.log | |
end script | |
start on runlevel [2345] | |
stop on runlevel [06] | |
script | |
cd /opt/backup-agent | |
exec nohup /usr/bin/env ./backup-agent >> /var/log/backup-agent/agent.log 2>&1 | |
end script |
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
# Ubuntu upstart file at /etc/init/mms-agent.conf | |
description "MongoDB Monitoring Service (MMS) Agent" | |
setuid nobody | |
setgid nogroup | |
pre-start script | |
if grep -q '@API_KEY@' /opt/mms-agent/settings.py || grep -q '@SECRET_KEY@' /opt/mms-agent/settings.py | |
then | |
logger -is -t "$UPSTART_JOB" "ERROR: api or secret key not set in settings.py!" | |
stop ; exit 1 | |
fi | |
end script | |
post-stop script | |
echo "$(date +'%Y-%m-%d %T,000') INFO mms-agent stopped" >> /var/log/mms-agent/agent.log | |
end script | |
start on runlevel [2345] | |
stop on runlevel [06] | |
exec nohup /usr/bin/env python /opt/mms-agent/agent.py >> /var/log/mms-agent/agent.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment