Cronjob to check and restart service if dead

For check and restart services, if they are inactive/dead.
 
$ nano service_ck.sh
 
#!/bin/bash
STATUS=$(systemctl is-active snort)
# Most services will return something like "active" if they are in fact "active"
test "$STATUS" = "active" || systemctl restart snort
 
Change file permissions:
$chmod +x service_ck.sh
  
Update your crontab:
$sudo crontab -e
 
add:
 
# min   hour    day month   dow cmd
*/1 *   *   *   *   /path/to/service_ck.sh
  
or 
 
#every minute:
* * * * * /path/to/service_ck.sh