Skip to content
Snippets Groups Projects
etc_init_d_elastalert 739 B
Newer Older
#!/bin/sh

### BEGIN INIT INFO
# Provides: elastalert
# Short-Description: Start and stop ElastAlert
# Description: ElastAlert
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO

export HOME=/root

# Action to take
case "$1" in
    start)
        echo "Starting ElastAlert ..."
        cd /opt/elastalert
        /usr/local/bin/elastalert &
        ;;
    stop)
        echo "Stoping ElastAlert ..."
        kill `pidof /usr/bin/python /usr/local/bin/elastalert` && echo "ElastAlert stopped"
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: service elastalert {start|stop|restart}"
        exit 1
        ;;
esac