Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Two instances of FR24feed on the same linux box?

  1. #11
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    UPDATED POST #7
    Log file functionally added by modifying service files

    Added code in red
    Code:
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1
    ExecStart=/usr/bin/fr24feed --fr24key=xxxxxxxxxxxxxxxx --receiver=beast-tcp --host=127.0.0.1:30005 --logmode=1 --logpath=/var/log/fr24-1/
    Last edited by abcd567; 2019-04-16 at 18:41.

  2. #12
    Captain
    Join Date
    Apr 2018
    Posts
    702
    That might fail because mkdir reports an error.
    You can use a minus sign before the command to ignore the return code of the command.

    Or you can use the -p option for mkdir so it doesn't report an error if the directory already exists.

    Otherwise the whole service might show an error.
    (On first run it will work as the directory doesn't exist yet)

    Also it's not necessary to run these commands on every start because the directories will remain with their permissions.
    (In case of dump1090-mutability using touch and chown that's different because the file needs to be overwritten on each start. In the directories though as soon as they are owned by fr24, the program can do whatever it wants inside of these directories)

  3. #13
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    Quote Originally Posted by wiedehopf View Post
    Or you can use the -p option for mkdir so it doesn't report an error if the directory already exists.
    Thanks for the tip.
    Added -p with mkdir command

  4. #14
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    Quote Originally Posted by wiedehopf View Post
    Do you just delete the /etc/fr24feed.ini when you give the parameters on the command line?

    Or do the command line parameters take precedence anyway?
    The binary does not create the fr24feed.ini, but searches for it if vital parameters (fr24key, receiver, host & port) are not added to start command as arguments, and if does not find the vital parameters, finally fails

    For single instance use, I create the file fr24feed.ini manually by touch command, then do chmod a+rw on it.

    If installation is done by .deb package, the .deb package creates the fr24feed.ini
    Last edited by abcd567; 2019-04-16 at 19:39.

  5. #15
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    OK, if you dont want to edit the service file every time you want to change parameters, then create a .ini file, and add some code in service file to get data from the .ini file

    STEP-1:
    Prepare fr24feed-1.ini and fr24feed-2.ini files

    1.1 - Feeder-1

    Code:
    sudo touch /etc/fr24feed-1.ini
    sudo chmod a+rw /etc/fr24feed-1.ini
    sudo nano /etc/fr24feed-1.ini
    Copy-paste following code, then save file (Ctrl+o) and (Ctrl+x)

    Code:
    RECEIVER="--receiver=beast-tcp"
    KEY="--fr24key=xxxxxxxxxxxxxxxx"
    HOST="--host=127.0.0.1:30005"
    OUTPUT="--bs=no --raw=no"
    LOG="--logmode=1 --logpath=/var/log/fr24-1"
    MLAT="--mlat=yes --mlat-without-gps=yes"
    CONNECTION="--use-http=yes  --http-timeout=20"

    1.2 - Feeder-2

    Code:
    sudo touch /etc/fr24feed-2.ini
    sudo chmod a+rw /etc/fr24feed-2.ini
    sudo nano /etc/fr24feed-2.ini
    Copy-paste following code

    Code:
    RECEIVER="--receiver=beast-tcp"
    KEY="--fr24key=yyyyyyyyyyyyyyyy"
    HOST="--host=127.0.0.1:31005"
    OUTPUT="--bs=no --raw=no"
    LOG="--logmode=1 --logpath=/var/log/fr24-2"
    MLAT="--mlat=yes --mlat-without-gps=yes"
    CONNECTION="--use-http=yes  --http-timeout=20"
    Save file (Ctrl+o) and (Ctrl+x)






    STEP-2:
    Change fr24feed-1.service and fr24feed-2.service files to become like this. (changes shown in red)

    1.1 Feeder-1
    Code:
    sudo nano /lib/systemd/system/fr24feed-1.service
    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    EnvironmentFile=/etc/fr24feed-1.ini
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1
    ExecStart=/usr/bin/fr24feed  $RECEIVER $KEY $HOST $OUTPUT $LOG $MLAT $CONNECTION
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target
    Save file (Ctrl+o) then (Ctrl+x)


    1.2 Feeder-2
    Code:
    sudo nano /lib/systemd/system/fr24feed-2.service
    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    EnvironmentFile=/etc/fr24feed-2.ini
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-2
    ExecStartPre=/bin/chown fr24 /var/log/fr24-2
    ExecStart=/usr/bin/fr24feed  $RECEIVER $KEY $HOST $OUTPUT $LOG $MLAT $CONNECTION
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target
    Save file (Ctrl+o) then (Ctrl+x)

    STEP-3:
    Implement the changes made in .service files

    Code:
    sudo systemctl daemon-reload 
    sudo systemctl restart fr24feed-1
    sudo systemctl restart fr24feed-1
    Last edited by abcd567; 2019-04-19 at 05:54.

  6. #16
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    I thought of another slightly different format of fr24feed ini file.

    Code:
    sudo nano /etc/fr24feed-1.ini

    Copy-paste following code in above file
    Code:
    CONFIG=" \
     --receiver=beast-tcp" \
     --fr24key=xxxxxxxxxxxxxxxx \
     --host=127.0.0.1:30005 \
     --bs=no \
     --raw=no \
     --logmode=1 \
     --logpath=/var/log/fr24-1 \
     --mlat=yes \
     --mlat-without-gps=yes \
     --use-http=yes \
     --http-timeout=20 "
    IMPORTANT:
    If you type the above code, make sure there is no blank space after back-slah \ .

    Better copy-paste from above instead of typing

    Code:
    [Unit] 
    Description=Flightradar24 Feeder 
    After=network-online.target 
    
    [Service] 
    Type=simple 
    Restart=always 
    LimitCORE=infinity 
    EnvironmentFile=/etc/fr24feed-1.ini 
    RuntimeDirectory=fr24feed 
    RuntimeDirectoryMode=0755 
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1 
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1 
    ExecStart=/usr/bin/fr24feed $CONFIG 
    User=fr24 
    PermissionsStartOnly=true 
    StandardOutput=null 
    
    [Install] 
    WantedBy=multi-user.target
    Last edited by abcd567; 2019-04-19 at 05:50.

  7. #17
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    @Khan
    @Oblivian

    By default fr24feed (arm & i386) serves status & settings page in browser at port 8754.

    If I want to change this to another port number, what is the process argument to be passed to fr24feed binary?

    As an example, dump1090 by default serves map in browser at port 8080. This can be customized to another port, for example 8787 by passing following process arguments to dump1090
    --net-http-port 8787

  8. #18
    Super Moderator
    Join Date
    May 2011
    Location
    T-NZCH1, PP:PH New Zealand
    Posts
    4,965
    From experience its hard coded. No way around

    Sent from my EML-L09 using Tapatalk
    Posts not to be taken as official support representation - Just a helpful uploader who tinkers

  9. #19
    Captain abcd567's Avatar
    Join Date
    Sep 2013
    Location
    Toronto CYYZ
    Posts
    2,733
    Quote Originally Posted by Oblivian View Post
    From experience its hard coded. No way around
    Oh boy!

  10. #20
    Captain
    Join Date
    Apr 2018
    Posts
    702
    I mean if someone does this he should be able to do the settings without the webinterface.
    No big loss imho.

    Anyway the number of people using this will likely be limited to the single digits.

    Also you should set the MLAT to no in your secondary feed:
    Code:
    MLAT="--mlat=no --mlat-without-gps=no"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •