The daemon process should quit at some point but gets restarted immediately

As stated in the headline - here is the situation:

I have a DaemonService installing and running a bash script. The start of execution is configured to automatically start as soon as the service is registered and the init() method is called. Depending on what tasks has to be done (a backup etc.) the runtime can be about 5 minutes but for the script it is also ok, if it quits (gracefully) after, lets say, <1 second.

When testing in the simulator the script installs and runs fine. But: I noticed, that after the script terminates, it gets restarted immediately.

I can think of some workarounds (e.g. calling the stop() method from outside the DaemonService) but i would really like to have some kind of “one-shot”-behaviour: run the script once and don’t restart it…

Is there a way to achieve that with the current API?

Best,
Johannes

In the meantime i worked around this. I achieved a “run once” behaviour by starting the daemon and stopping it after 10 seconds directly in the init() method of the registered service.

	this.dependencyInstallationContribution.start();
	
	try {
		for(int i=0; i<10; i++) {
			Thread.sleep(1000);
		}
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	this.dependencyInstallationContribution.stop();

may be this can help somebody else if needed :slight_smile: