Hello Andrey.
Some (good) news from the front!
This worked on my system:
1) Be sure that portaudio is installed in your system:
$ sudo apt install libportaudio22) Use '
system' as library name for uos_loadlib
uos_LoadLib('system', nil, nil, nil, nil, nil);3) This is my
/lib/systemd/system/MyService.service (adapt the directory with yours):
[Unit]
Description=MyDescription
After=multi-user.target
[Service]
Type=idle
ExecStart=+/home/fred/uos_demo/consolesynth
Restart=on-failure
RestartSec=10
KillMode=process
RemainAfterExit=yes
[Install]
WantedBy=multi-user.targetIn attachment the demo
consolesynth binary using '
system' for uos_loadlib(), copy it somewhere and adapt the code of the service:
uos_demo.zipThen do:
$ sudo systemctl daemon-reload$ sudo systemctl enable MyService.service$ sudo systemctl start MyService.serviceTo reload it do
sudo systemctl restart MyServiceThis is the result of
sudo systemctl status MyService:
$
sudo systemctl status MyService● MyService.service - MyDescription
Loaded: loaded (/lib/systemd/system/MyService.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2024-01-26 03:18:54 CET; 8min ago
Process: 12377 ExecStart=/home/fred/uos_demo/consolesynth (code=exited, status=0/SUCCESS)
Main PID: 12377 (code=exited, status=0/SUCCESS)
CPU: 475ms
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: Cannot connect to server socket err = No such file or directory
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: Cannot connect to server request channel
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: jack server is not running or cannot be started
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ene 26 03:18:54 fred-IdeaPad consolesynth[12377]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ene 26 03:18:58 fred-IdeaPad consolesynth[12377]: Result of loading (if 0 => ok ) : 0
--------------------
I hope you will be able to do it with your application.
It seems that
systemctl does not allow to libraries that are not from the system.
Fre;D