I am using systemd to start an executable at boot time on a single board computer (embedded) platform. I want this app to run in headless mode - no logging in - and the user will control the input through a web browser.
I am using a TS-7800-V2 which runs Debian.
Here is my service (webserver.service) set up (etc/systemd/system):
[Unit]
Description=Run LWSWS webserver on startup
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=simple
ExecStart=/libwebsockets/build/bin/lwsws
[Install]
WantedBy=multi-user.target
I have enabled and started the service, and checked the status:
root@ts7800-v2:~# systemctl status webserver.service
��● webserver.service - Run LWSWS webserver on startup
Loaded: loaded (/etc/systemd/system/webserver.service; enabled; vendor preset
Active: active (running) since Mon 2017-12-11 11:23:39 PST; 11min ago
Main PID: 2408 (lwsws)
CGroup: /system.slice/webserver.service
��└��─2408 /libwebsockets/build/bin/lwsws
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: mounting callback://proto
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: Using non-SSL mode
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: created client ssl context f
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: Unable to find interface eth
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: init server failed
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: Failed to create vhost local
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: /etc/lwsws/conf.d/test-serve
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: lwsws[2416]: Context creation failed
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: GPS THREAD created successfully
Dec 11 11:23:39 ts7800-v2 lwsws[2408]: MOTOR CONTROL THREAD created successfully
So, the service is active and running, but the eth0 connection is not being made so that the web server (libwebsockets web server LWSWS) cannot start up properly.
My question is how to get Ethernet to startup on boot so that the web server can start up and run?
In the dependencies for this service, the networking shows in the tree before the rest of the service startup:
root@ts7800-v2:/etc/systemd/system# systemctl list-dependencies webserver.service
��● ��├��─system.slice
��● ��├��─network-online.target
��● ��│ ��└��─networking.service
��● ��└��─sysinit.target
��● ��├��─dev-hugepages.mount
��● ��├��─dev-mqueue.mount
��● ��├��─kmod-static-nodes.service
��● ��├��─proc-sys-fs-binfmt_misc.automount
��● ��├��─sys-fs-fuse-connections.mount
��● ��├��─sys-kernel-config.mount
��● ��├��─sys-kernel-debug.mount
��● ��├��─systemd-ask-password-console.path
��● ��├��─systemd-binfmt.service
��● ��├��─systemd-hwdb-update.service
��● ��├��─systemd-journal-flush.service
��● ��├��─systemd-journald.service
��● ��├��─systemd-machine-id-commit.service
��● ��├��─systemd-modules-load.service
��● ��├��─systemd-random-seed.service
��● ��├��─systemd-sysctl.service
��● ��├��─systemd-timesyncd.service
��● ��├��─systemd-tmpfiles-setup-dev.service
Advice on how to get the network started before the web server starts would be appreciated. Thanks!