Init.d service does not autostart


I installed prometheus-node-exporter-lua. It is enabled in LuCI --> System --> Startup. Link in /etc/rc.d exists. Still, the service does not automatically start. When started manually, either from LuCI or via console, it runs instantly.

Any ideas for further troubleshooting?


Well, looking at the init.d scripts, it starts quite early in the boot process. If the interfaces are not up at that point, it won't start.

Are you seeing the log message in your logs: "deferring start until listen interface $interface becomes ready"

#!/bin/sh /etc/rc.common
# Copyright (C) 2013-2017


_log() {
	logger -p -t prometheus-node-exporter-lua "$@"

start_service() {
	. /lib/functions/

	local interface ipv6 port bind

	config_load prometheus-node-exporter-lua.main
	config_get interface "main" listen_interface "loopback"
	config_get_bool ipv6 "main" listen_ipv6 0
	config_get port "main" listen_port 9100

	if [ "$interface" = "*" ]; then
		[ "$ipv6" = 1 ] && bind="::" || bind=""
		if [ "$ipv6" = 1 ]; then
			network_get_ipaddr6 bind "$interface"
			network_get_ipaddr bind "$interface"

		network_is_up "$interface" && [ -n "$bind" ] || {
			_log "defering start until listen interface $interface becomes ready"
			return 0

Thanks for your answer. Theres nothing like that in logread (logread | grep until).

I will try editing the init.d script increasing the START variable...

If you do that you'll need to disable it then re-enable it so that it recreates the correct symlink in /etc/rc.d

It doubt that is an issue. Add this line to the beginning of your script to get the output during the startup. Then see what is in that file after a reboot.

exec >>/root/log 2>&1

Thanks for your help.

START=80 does not help.

Where do I put the exec >>/root/log 2>&1? I tried before and after start_service() {.
/root/log stays empty...

Is the service enabled? Are there start/stop links to the file?

Before START. Add these lines as well to make sure the script gets invoked during boot:

exec >>/root/log 2>&1
echo "STARTED"
set -x