I was suggesting you edit your rtorrent start script: https://gist.github.com/russellsimpkins-nyt/fd917de3131d5938a8c3529bdae27a79#file-rtorrent-L68
However, there seems no reason to watch the rtorrent pid if it's death kills the screen pid. On Mon, May 16, 2016 at 11:58 AM, Josu Lazkano <[email protected]> wrote: > Thanks Russell, > > I don't understand your code, where must I add this? in the init > script or in the monit script? > > I normally configure this way: > > check process rtorrent with pidfile /var/run/rtorrent.pid > start program = "/etc/init.d/rtorrent start" > stop program = "/etc/init.d/rtorrent stop" > > And yes, If I kill the rtorrent, the screen process disappear: > > root@server:~# ps -e | grep rtorrent > 17523 pts/1 00:00:00 rtorrent > root@server:~# ps -e | grep screen > 17521 ? 00:00:00 screen > root@server:~# killall rtorrent > root@server:~# ps -e | grep screen > root@server:~# ps -e | grep rtorrent > > 2016-05-16 17:34 GMT+02:00 Russell Simpkins <[email protected]>: > > If you kill rtorrent, does screen die as well? If so, then it's probably > > fine to watch the screen pid. > > > > You could write the pid if it starts correctly e.g. > > > > if [[ $? -ne 0 ]]; then > > echo "Error: rtorrent failed to start." > > exit 1 > > else > > ps -e | grep [r]torrent | awk '$1 ~ /[0-9]+/ {print $1}' > > > /var/run/torrent.pid > > fi > > > > > > On Mon, May 16, 2016 at 11:13 AM, Josu Lazkano <[email protected]> > > wrote: > >> > >> Hello all, > >> > >> I have a little server running some services that I monitor with > >> Monit, it really work great. > >> > >> Now I have rtorrent service running, but the problem is that it is > >> executed inside screen terminal: > >> > >> > https://raw.githubusercontent.com/mjsilva/rtorrent-screen-debian-init-script/master/rtorrent > >> > >> So I have this: > >> > >> # ps -e | grep rtorrent > >> 22292 pts/1 00:44:39 rtorrent > >> > >> # ps -e | grep screen > >> 22291 ? 00:00:06 screen > >> > >> # cat /var/run/rtorrent.pid > >> 22291 > >> > >> So the PID is associated with screen, not with rtorrent. > >> > >> How could I manage this situation? > >> > >> I will really appreciate your help, best regards. > >> > >> -- > >> Josu Lazkano > >> > >> -- > >> To unsubscribe: > >> https://lists.nongnu.org/mailman/listinfo/monit-general > > > > > > > > -- > > To unsubscribe: > > https://lists.nongnu.org/mailman/listinfo/monit-general > > > > -- > Josu Lazkano > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general >
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
