#!/bin/sh

STATUS_SKIP=77

check_apache() {
    netstat --tcp -ln | grep 80

    if [ "$?" != 0 ]; then
        echo "apache2 is not listening at port TCP/80"
        echo "ending $0 with status $STATUS_SKIP"
        exit $STATUS_SKIP
    fi
}

load_module() {
    a2enmod lisp
}

restart_apache() {
    systemctl restart apache2
}

## main
check_apache
load_module
restart_apache

exit 0
