Skip to content

Instantly share code, notes, and snippets.

@mbtamuli
Last active December 15, 2016 09:43
Show Gist options
  • Save mbtamuli/d7724000980510121b3b5cf3d4a48108 to your computer and use it in GitHub Desktop.
Save mbtamuli/d7724000980510121b3b5cf3d4a48108 to your computer and use it in GitHub Desktop.
Monit start scripts
# This is an upstart script to keep monit running.
# To install disable the old way of doing things:
#
# /etc/init.d/monit stop && update-rc.d -f monit remove
#
# then put this script here:
#
# /etc/init/monit.conf
#
# and reload upstart configuration:
#
# initctl reload-configuration
#
# You can manually start and stop monit like this:
#
# start monit
# stop monit
#
description "Monit service manager"
limit core unlimited unlimited
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
expect daemon
respawn
exec /usr/local/bin/monit -c /etc/monitrc
pre-stop exec /usr/local/bin/monit -c /etc/monitrc quit
# This file is systemd template for monit service. To
# register monit with systemd, place the monit.service file
# to the /lib/systemd/system/ directory and then start it
# using systemctl (see bellow).
#
# Enable monit to start on boot:
# systemctl enable monit.service
#
# Start monit immediately:
# systemctl start monit.service
#
# Stop monit:
# systemctl stop monit.service
#
# Status:
# systemctl status monit.service
[Unit]
Description=Pro-active monitoring utility for unix systems
After=network.target
[Service]
Type=simple
KillMode=process
ExecStart=/usr/local/bin/monit -I
ExecStop=/usr/local/bin/monit quit
ExecReload=/usr/local/bin/monit reload
Restart = on-abnormal
[Install]
WantedBy=multi-user.target
# /etc/default/monit
# Defaults for monit initscript. This file is sourced by
# /bin/sh from /etc/init.d/monit.
# Set START to yes to start the monit
START=yes
# Options to pass to monit
#MONIT_OPTS=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment