How to make the XMR run automaticaly

Here’s an easier way to run XMR as a systemd service on Ubuntu (18.04).

Copy the whole block into your terminal and it will create the xibo-xmr service. You might want to adjust some values before doing that. In the [Service] section, adjust User and Group the whatever your web server / php is also running as. Usually it’s the www-data user. ExecStart requires the correct paths to your php binaries and the xmr.phar file included in Xibo.

sudo cat <<EOF >>/etc/systemd/system/xibo-xmr.service
[Unit]
Description=Xibo XMR
After=network.target

[Service]
User=www-data
Group=www-data
ExecStart=/usr/bin/php /srv/www/xibo/vendor/bin/xmr.phar
Restart=always
KillMode=process

[Install]
WantedBy=multi-user.target
EOF

Reload the systemd manager, enable the service at startup and finally, start the xmr service.

sudo systemctl daemon-reload
sudo systemctl enable xibo-xmr.service
sudo systemctl start xibo-xmr.service

You can check the status if the xmr service is properly running. Set debug to false in your config.json for detailed output. Output example to verify that xmr is running and php is listening to the internal cms and public display port set in config.json.

$ sudo systemctl status xibo-xmr
● xibo-xmr.service - Xibo XMR
   Loaded: loaded (/etc/systemd/system/xibo-xmr.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-12-17 22:37:19 UTC; 3s ago
 Main PID: 22496 (php)
    Tasks: 3 (limit: 4915)
   CGroup: /system.slice/xibo-xmr.service
           └─22496 /usr/bin/php /srv/www/xibo/vendor/bin/xmr.phar

Dec 17 22:37:19 srv001 systemd[1]: Started Xibo XMR.

$ sudo lsof -i -P -n | grep 22496
php       22496        www-data   10u  IPv4 816472      0t0  TCP 127.0.0.1:50001 (LISTEN)
php       22496        www-data   12u  IPv4 816474      0t0  TCP 10.0.30.10:9505 (LISTEN)