Hi,
I have set up my server running Ubuntu 18.04 server to load vhclientx86_64 as a service. I added the vhui script, and that works fine to start and stop the client as a service.
This is your vhui script https://www.virtualhere.com/sites/default/files/usbclient/scripts/vhui
The problem is that I use monit to start and stop services, and this needs the pid to check if the service is running.
The vhui script is supposed to write the pid into file /var/run/vhclientx86_64.pid, but it never creates the file. I have tried other locations, but nothing gets the pid into a file.
Before I start jumping through scripting hell trying to get the pid into a file, is this supposed to work? am I doing something wrong?
This line:
start-stop-daemon --start --quiet --background --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
works, and is passed the correct $PIDFILE, but the file is never written.
Is this a bug?
Thanks.
Nick.
.
No vhusbd wont write the pid. But that utility can automatically write it see here (https://unix.stackexchange.com/questions/137519/start-stop-daemon-not-w…)
Can’t Get PID of vhclient
Ok, I tried adding --make-pidfile, which does then make the pid file, but starting vhclient as a daemon (-n) means that the process starts, forks and exits - which means the pid in the file is incorrect. It’s the pid of the process that started, and exited, not the fork which is still running.
Can I suggest that you add an option to the Linux branches of the client (and server) application to allow the pid of the running process to be written to a file, as this makes daemon and server control much easier.
Otherwise, the program is working perfectly on the first try - very impressive! Serving my USB devices from a RPi, I can now access two USB serial devices and two Bluetooth dongles from my virtual servers without any physical connections. Great!
.
You shouldnt run the client as a daemon (remove the -n argument) and it will be ok then.
Doh! Should of thought of
Doh! Should of thought of that.
So, yes, that fixes things right up.
Many thanks.