Any thoughts?
I have 2 Piaware instances running on one RPI
The “ExecStart=
” lines in service files of these instances are as follows:
Instance 1:
sudo nano /lib/systemd/system/piaware.service
ExecStart=/usr/bin/piaware -p %t/piaware/piaware.pid -plainlog -statusfile %t/piaware/status.json
Instance 2:
sudo nano /lib/systemd/system/piaware2.service
ExecStart=/usr/bin/piaware -p %t/piaware2/piaware.pid -plainlog -statusfile %t/piaware2/status.json -configfile /etc/piaware2.conf -cachedir /var/cache/piaware2
.
Both instances are feeding logs to same file:
pi@raspberrypi:~ $ cat /var/log/piaware.log
Aug 4 22:40:23 raspberrypi piaware[550]: logged in to FlightAware as user abcd567
Aug 4 22:40:23 raspberrypi piaware[550]: my feeder ID is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Aug 4 22:40:23 raspberrypi piaware[572]: Starting faup1090: /usr/lib/piaware/helpers/faup1090 --net-bo-ipaddr 127.0.0.1 --net-bo-port 31005 --stdout --lat 43.xxx --lon -79.xxx
Aug 4 22:40:23 raspberrypi piaware[550]: site statistics URL: https://flightaware.com/adsb/stats/user/abcd567#stats-5252
......
......
Aug 4 22:40:23 raspberrypi piaware[572]: logged in to FlightAware as user abcd567
Aug 4 22:40:23 raspberrypi piaware[572]: my feeder ID is yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
Aug 4 22:40:23 raspberrypi piaware[572]: site statistics URL: https://flightaware.com/adsb/stats/user/abcd567#stats-6396
.
I tried two workarounds:
workaround-1: In service file of instance 2, in line starting with ExecStart=
, replaced -plainlog
by -logfile /var/log/piaware2.log
. This did not work.
workaround-2: Added following line in service file of instance 2:
StandardOutput=file:/var/log/piaware2.log
This succeeded in diverting instance 2’s log to its own log file /var/log/piawar2.log
, but completely spoiled the output of status command:
pi@raspberrypi:~ $ sudo systemctl status piaware2
● piaware2.service - FlightAware ADS-B uploader
Loaded: loaded (/lib/systemd/system/piaware2.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2019-08-04 23:02:13 EDT; 4s ago
Docs: https://flightaware.com/adsb/piaware/
Main PID: 7055 (piaware)
Tasks: 4 (limit: 2200)
Memory: 9.6M
CGroup: /system.slice/piaware2.service
├─7055 /usr/bin/piaware -p /run/piaware2/piaware.pid -plainlog -statusfile /run/piaware2/status.json -configfile /etc/piaware2.conf -cachedir /v
├─7088 /usr/lib/piaware/helpers/fa-mlat-client --input-connect 127.0.0.1:31005 --input-type auto --results beast,connect,localhost:31104 --udp-t
└─7099 /usr/lib/piaware/helpers/faup1090 --net-bo-ipaddr 127.0.0.1 --net-bo-port 31005 --stdout --lat 43.xxx --lon -79.xxx
Aug 04 23:02:16 raspberrypi sudo[7063]: piaware : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=list /bin/netstat --program --tcp --wide --all --numeric
Aug 04 23:02:16 raspberrypi sudo[7065]: piaware : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/netstat --program --tcp --wide --all --numeric
Aug 04 23:02:16 raspberrypi sudo[7065]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 04 23:02:16 raspberrypi sudo[7065]: pam_unix(sudo:session): session closed for user root
Aug 04 23:02:17 raspberrypi sudo[7078]: piaware : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/netstat --program --tcp --wide --all --numeric
Aug 04 23:02:17 raspberrypi sudo[7078]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 04 23:02:17 raspberrypi sudo[7078]: pam_unix(sudo:session): session closed for user root
Aug 04 23:02:17 raspberrypi sudo[7089]: piaware : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/netstat --program --tcp --wide --all --numeric
Aug 04 23:02:17 raspberrypi sudo[7089]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 04 23:02:17 raspberrypi sudo[7089]: pam_unix(sudo:session): session closed for user root
.
I added one more line (StandardError) in service file, but it did not change the output of systemcl status piaware
:
StandardOutput=file:/var/log/piaware2.log
StandardError=file:/var/log/piaware2error.log
.
The log file piaware2.log
shows piaware2 is working OK.
pi@raspberrypi:~ $ cat /var/log/piaware2.log
creating pidfile /run/piaware2/piaware.pid
****************************************************
....
....
logged in to FlightAware as user abcd567
my feeder ID is yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyy
site statistics URL: https://flightaware.com/adsb/stats/user/abcd567#stats-6396
multilateration data requested
.....
.....
mlat-client(7088): Aircraft: 6 of 11 Mode S, 18 of 22 ADS-B used
1567 msgs recv'd from dump1090-mutabi (594 in last 5m); 1567 msgs sent to FlightAware