Monitor script F6fbb

Brain N1URO has written a script to see if fbb is still running.
I saved this script in the fbb directory.
/usr/local/etc/ax25/fbb

Have it saved as “fbbcheck” now it is possible to call it via a cronjob every hour.

Edit the /etc/crontab file and add the following.

15 *    * * *   root    /usr/local/etc/ax25/fbb/fbbcheck

Now, every 15 minutes after the full hour, it is checked whether fbb is still running, otherwise it will be restarted.

Here under the “fbbcheck” script.

#! /bin/sh

. /lib/lsb/init-functions

MYFBB=`ps ax|grep fbb|grep xfbbd|grep sbin|awk '{ print $1 }'`
PID=`ps ax|grep fbb|grep xfbbd|grep sbin|awk '{ print $1 }'`

if [ -z $MYFBB ]
  then
   log_warning_msg "FBB BBS not found running"
   sleep 2
   log_action_msg "Reloading FBB... "
   sleep 2
   /usr/local/sbin/fbb -s -a
   log_daemon_msg "FBB Reloaded" "done"
   log_end_msg 0

exit 1
fi
  log_action_msg "FBB PBBS is running on pid: $PID"
  exit 0

Tnx to Brain N1URO
http://n1uro.ampr.org/

I made a small addition to the script myself. Now I can also see how long fbb has been running and when fbb has been started. (just fun )

#! /bin/sh

. /lib/lsb/init-functions

MYFBB=`ps ax|grep fbb|grep xfbbd|grep sbin|awk '{ print $1 }'`
PID=`ps ax|grep fbb|grep xfbbd|grep sbin|awk '{ print $1 }'`
UPTIME=`ps -p $PID -o %t | tail -1|awk '{ print $1 }'`
START=`ps -p $PID -o lstart=`

if [ -z $MYFBB ]
  then
   log_warning_msg "FBB BBS not found running"
   sleep 2
   log_action_msg "Reloading FBB... "
   sleep 2
   /usr/local/sbin/fbb -s -a
   log_daemon_msg "FBB Reloaded" "done"
   log_end_msg 0

exit 1
fi
  log_action_msg "FBB BBS PI8LAP is running on pid : $PID"
  log_action_msg "FBB BBS PI8LAP is Started on : $START"
  log_action_msg "FBB BBS PI8LAP is running for : $UPTIME dd:hh:mm:ss"
exit 0

Looks like this.

root@pi1lap-base:/usr/local/etc/ax25/fbb# ./fbbcheck
[info] FBB BBS PI8LAP is running on pid : 2573.
[info] FBB BBS PI8LAP is Started on : Sat Sep  2 06:23:02 2017.
[info] FBB BBS PI8LAP is running for : 01:10:44 dd:hh:mm:ss.
root@pi1lap-base:/usr/local/etc/ax25/fbb#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.