OpenBCM V1.07b12 (Linux)

Packet Radio Mailbox

IW8PGT

[Mendicino(CS)-Italy]

 Login: GUEST





  
K5DAT  > PACKET   01.03.20 23:26l 64 Lines 1412 Bytes #999 (0) @ WW
BID : 21495_K5DAT
Read: GUEST
Subj: Starting linbpq from systemd
Path: IW8PGT<HB9ON<IW0QNL<JH4XSY<N3HYM<KC9VYU<W9GM<K5DAT
Sent: 200213/0546Z 21495@K5DAT.#CWI.WI.USA.NOAM LinBPQ6.0.19

Actually starting linbpq (or any application) via systemd as
a non-root user can be done within the systemd service.


(Create a text file named linbpq.service in /etc/systemd/system)
The contents of linbpq.service would look like this if 
the user and primary group are bpq. Adjust user, group
and path to linbpq executable as needed.


[Unit]
After=network.target

[Service]
User=bpq
Group=bpq
ExecStart=/home/bpq/linbpq
Restart=always

[Install]
WantedBy=multi-user.target


After creating the linbpq.service file, issue these commands as was noted before:

sudo systemctl daemon-reload
sudo systemctl enable linbpq.service

The second one will result in starting linbpq at bootup.

I run linbpq under screen, so my linbpq.service file looks like this:
Note my user and group are lee, and the path is different - so modify
as necessary.

[Unit]
Description=BPQ
After=network.target

[Service]
Type=forking
WorkingDirectory=/home/lee/BPQ
User=lee
Group=lee
ExecStart=/usr/bin/screen -S bpq -d -m /home/lee/BPQ/linbpq
SyslogIdentifier=BPQ

[Install]
WantedBy=multi-user.target


The above runs linbpq in a detached screen session named bpq.
To attach to the session, issue...
screen -r bpq
Attaching to the session allows you to see whether or not BPQ started properly.
To detach, issue...
Ctrl-a d

You might need to install screen - (sudo apt-get install screen)
if Debian/Raspian or Ubuntu.


73,
Lee K5DAT


Read previous mail | Read next mail


 23.12.2024 08:56:23lGo back Go up