Skip to content
Advertisement

how to daemonize a script

I am trying to use daemon on Ubuntu, but I am not sure how to use it even after reading the man page.

I have the following testing script foo.sh

JavaScript

Then I tried this command but nothing happened:

JavaScript

The file hihihi was not updated, and I found this in the errlog:

JavaScript

How could I use the daemon command properly?

Advertisement

Answer

AFAIK, most daemon or deamonize programs change the current dir to root as part of the daemonization process. That means that you must give the full path of the command:

JavaScript

If it still did not work, you could try to specify a shell:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement