# # ExecStartPre # If more than one command is specified, the # commands are invoked sequentially in the # order they appear in the unit file. If one # of the commands fails (and is not prefixed # with "-"), other lines are not executed, # and the unit is considered failed. # [Unit] Description=Ramal Monitor - Simple IP [Service] Type=forking # verifica se o serviço está rodando ExecStartPre=/bin/bash -c '! /usr/bin/systemctl is-active --quiet monitor-ramal.service' # Limpa pid em /var/lock/subsys/monitor-ramal.pid ExecStartPre=/bin/bash -c "echo > /var/lock/subsys/monitor-ramal.pid" ExecStart=/var/lib/asterisk/scripts/monitoramento/mntRamal.php PIDFile=/var/lock/subsys/monitor-ramal.pid Restart=always RestartSec=1 [Install] WantedBy=multi-user.target