PROCD: Switched to procd and nothing works anymore

Hi,
I wanted to switch from a normal init script to procd.
For my old init script I was just starting my daemon and it forked into the background.
Now I can't run the daemon anymore in the foreground.
If I don't fork the daemon in the background it doesn't care... Is procd doing something like this for me?

#!/bin/sh /etc/rc.common
 
USE_PROCD=1

START=50
STOP=50

PROG=/usr/sbin/example
NAME=example
PIDCOUNT=0

example_instance(){
	echo "example instance starting!"
	procd_open_instance
	procd_set_param command "$PROG"
  	procd_close_instance
}

start_service()
{
	echo "Starting Service..."
	config_load "${NAME}"
	config_foreach example_instance example
}

Is this wrong?

Services launched by procd must not fork themselves to background, since that prevents procd from tracking them.
Yes, usually procd takes care of forking your process.

Your init file attempts to read a configuration /etc/config/example and will spawn an instance of /usr/sbin/example for each config example section it finds in the configuration file - is this what you want or did you just copy that from somewhere?

Actually I looked at dropbear's init file.

Now I modified this file a bit.

#!/bin/sh /etc/rc.common
 
USE_PROCD=1

START=50
STOP=50

PROG=/usr/sbin/example
NAME=example

start_service()
{
	echo "Starting Service..."
	config_load "${NAME}"

	procd_open_instance
	procd_set_param command "$PROG"
	#procd_append_param command stdout 1
        #procd_set_param stdout 1

	procd_set_param respawn
  	echo "example instance started!"
}

I thought that

procd_set_param stdout 1

would forward the stdout to logd? So I can read the messages via

logread

This is not working. :confused: And I can't find a way to run the daemon in foreground...


Somehow it works now. :open_mouth: Sorry