1

I have a home server running TrueNAS Core. Inside a Jail, I have Plex mediaserver running so I can easily view my photos on my TV. Due to some bug in Plex, it sometimes crashes when I add new pictures. Of course this'll get fixed eventually, but until then I want to set something up so that Plex will automatically start again after it crashes.

I have tried setting up daemontools, but none of the guides I followed resulted in Plex automatically restarting. I think this is because I have Plex setup as a service instead of running a single script to start it.

Is there a way to monitor certain services on FreeBSD, and automatically restart them when they go down? I've searched everywhere I know but my queries yield no useful results.

Thanks

1 Answer 1

1

Is there a way to monitor certain services on FreeBSD, and automatically restart them when they go down?

There is an open source program called Monit:

Monit is a utility for managing and monitoring processes, files, directories, devices and network services on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

monit supports:

  • Daemon mode - poll services at a specified interval -Group and manage groups of services, service dependencies
  • Logging - syslog or own logfile
  • Alert, start, stop and restart of services based on it's characteristics
  • MD5 and SHA1 checksums
  • Runtime Unix socket and TCP/IP port checking (TCP and UDP)
  • Process status, timeout, memory and cpu usage, etc.
  • Device usage monitoring (inodes and space)
  • File monitoring (timestamp, checksum, permission, owner, etc.)
  • Directory monitoring (timestamp, permission, owner, etc.)
  • Remote network services monitoring (ping, response time, protocol, etc.)
  • System load average monitoring
  • Flexible and customizable email alert messages and notifications
  • Protocol verification such as HTTP, FTP, SMTP, POP, IMAP, NNTP, NTP, etc.
  • A HTTP interface with XML output option

(Emphasis mine)

Source FreshPorts -- sysutils/monit: Unix system management and proactive monitoring

It can be downloaded from Easy, proactive monitoring of processes, programs, files, directories, filesystems and hosts | Monit, where it states:

Monit is a small Open Source utility for managing and monitoring Unix systems. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

...

Both FreeBSD and OpenBSD include Monit packages.

(Emphasis mine)

1
  • I found Monit a bit hard to set up. I used supervisord instead, which I liked more.
    – arrowd
    Dec 21, 2020 at 7:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .