With linux as a supported platform, it would be good to supply some startup scripts for both the server and scanner.
This will make it really easy for users to get it setup to auto-start with the os.
I believe Ubuntu 17.10 and newer is using systemd, and 16.04 is using upstart. We are probably better off going with just systemd, but that may want to be discussed.
One thing that will need looking into, is whether the server can be started via this method.
Will it have access to the x11 server? Could we get an OpenGL context another way?
There could also be other dependency issues to think of.
One thing that will need looking into, is whether the server can be started via this method.
Will it have access to the x11 server? Can we get an OpenGL context another way?
There could also be other dependency issues to think of.
This can be done using systemd user service. You will need to set up an auto-login user and enable the service for that user. As soon as the user logs in, the service will be launched and will have running X server.
FWIW 16.04 also uses systemd, so no need to worry about upstart
FWIW 16.04 also uses systemd
Fair enough. I know that 14.04 uses upstart, and I just assumed 16.04 did too. systemd still feels a bit new to have made it in there. But that makes this simpler then :)
This can be done using systemd user service.
That is good to know. I would still prefer to remove the dependency on x11, but that is a separate discussion.
I use the following:
/etc/systemd/user/media-scanner.service :
[Unit]
Description=CasparCG media scanner service
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/opt/CasparCG-server
ExecStart=/opt/CasparCG-server/scanner
RestartSec=1
Restart=always
StartLimitInterval=0
[Install]
WantedBy=default.target
as user: systemctl --user enable media-scanner.service
/etc/systemd/user/casparcg-server.service :
[Unit]
Description=CasparCG server service
After=network-online.target media-scanner.service
[Service]
Type=simple
WorkingDirectory=/opt/CasparCG-server
ExecStart=xterm -e /opt/CasparCG-server/run.sh
RestartSec=1
Restart=always
StartLimitInterval=0
[Install]
WantedBy=default.target
as user: systemctl --user enable casparcg-server.service
If I don't use xterm, server launches, but consumes 100% cpu.
Here are the scripts that we use on Ubuntu 18.04: casparcg-scripts.tar.gz
Extract the archive into your home dir:
tar -xvzpf /path/to/casparcg-scripts.tar.gz -C "$HOME"
It will create the following files:
bin/casparcg-client
bin/casparcg-server
.local/share/applications/casparcg-client.desktop
.local/share/applications/casparcg-server.desktop
.local/share/icons/casparcg-client.png
.local/share/icons/casparcg-server.png
The scripts assume that the server and the client are installed in the $HOME/server and $HOME/client directories. If that's not the case, modify bin/casparcg-server and bin/casparcg-client respectively.
You will now have 2 scripts in your bin dir that you can use to launch the server and the client from command line, as well as 2 icons (.desktop files) in your menu that you can pin to your task bar.
The nice thing about the server .desktop file is that when click on it, it won't spit out a new terminal icon (which gets mixed up with your other terminals), but will stay under the server icon.
Most helpful comment
I use the following:
/etc/systemd/user/media-scanner.service :
as user: systemctl --user enable media-scanner.service
/etc/systemd/user/casparcg-server.service :
as user: systemctl --user enable casparcg-server.service
If I don't use xterm, server launches, but consumes 100% cpu.