execute monit command in bash script
Issue #721
closed
hi.
i want in my bash script myscript.sh
execute monit script . example :
monit file is:
check process mariadb with pidfile /var/mysql/mysql.pid
if failed then exec "another_script.sh"
if we want this monit file, execute by one script
then return result? for sample:
#!/bin/bash
check process mariadb with pidfile /var/mysql/mysql.pid
if failed then exec "another_script.sh"
[root@server]# ./script.sh ; echo $?
Comments (2)
-
repo owner -
repo owner - changed status to closed
- Log in to comment
Hello David,
you can use the "check program", which allows for return value (status) testing. The exec action then allows to execute another script on failure: https://mmonit.com/monit/documentation/monit.html#PROGRAM-STATUS-TEST