Systemd and Linfbb

I had some problems starting Linfbb with systemd. The problem turned out to be that Linfbb was running in the background. Systemd was thinking fbb was going offline and kept restarting. Now it is possible to provide start options with fbb.

Command line options of the fbb script :
—————————————-
-f : Software is run in foreground
-h : help information
-q : run silent
-l logfile : log debug info to logfile

Now I put the following in my fbb start file.

pd9q@packet:~/linbpq $ cat fbb.start
# Start Linfbb file
sudo /usr/local/sbin/fbb -f -l /home/pd9q/linbpq/fbb.log

The unit file for systemd.

pd9q@packet:~/linbpq $ cat /etc/systemd/system/fbb.service
[Unit]
Description=LinFbb Daemon
After=network.target
After=linbpq.target
After=direwolf.target
StartLimitInterval=0

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStartPost=/bin/sh -c "echo $MAINPID > /home/pd9q/linbpq/run/fbb.pid"
ExecStart=/bin/sh /home/pd9q/linbpq/fbb.start

[Install]
WantedBy=multi-user.target
Alias=fbb.service

Systemctl status fbb

pd9q@packet:~/linbpq $ sudo systemctl status fbb
● fbb.service - LinFbb Daemon
   Loaded: loaded (/etc/systemd/system/fbb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-10-27 06:04:57 UTC; 24min ago
  Process: 536 ExecStartPost=/bin/sh -c echo $MAINPID > /home/pd9q/linbpq/run/fbb.pid (code=exited, status=0/SUCCESS)
 Main PID: 535 (sh)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/fbb.service
           ├─535 /bin/sh /home/pd9q/linbpq/fbb.start
           ├─541 sudo /usr/local/sbin/fbb -f -l /home/pd9q/linbpq/fbb.log
           ├─584 /bin/bash /usr/local/sbin/fbb -f -l /home/pd9q/linbpq/fbb.log
           └─826 /usr/local/sbin/xfbbd -a

Oct 27 06:05:02 packet sh[535]: 1 records updated
Oct 27 06:05:02 packet sh[535]: Files set-up complete
Oct 27 06:05:02 packet sh[535]: FORWARD set-up
Oct 27 06:05:02 packet sh[535]: BBS set-up
Oct 27 06:05:02 packet sh[535]: Set-up complete
Oct 27 06:05:02 packet sh[535]: GMT 06:05 - LOCAL 06:05
Oct 27 06:05:02 packet sh[535]: Starting multitasking ... ok
Oct 27 06:05:02 packet sh[535]: FBB options : -a
Oct 27 06:05:02 packet sh[535]: Running XFBB in foreground mode ^C to abort
Oct 27 06:05:07 packet sh[535]: Starting XFBB (pwd = /usr/local/var/ax25/fbb)...

Now is fbb running just fine.