Skip to main content

Here's a way to daemonize any shell process, no external programs needed:

( while sleep 5; do date; done ) <&- >output.txt & 

When you then close your session, the job will continue to run as evidenced by the output.txt file (which has buffering so it takes a while to show non-zero). Don't forget to kill your job after testing :-).

So all you need to do is close stdin and background the job. To be really good, first cd to /cd / so you don't hold on to a mount.

This works even in simple sh under Solaris.

Here's a way to daemonize any shell process, no external programs needed:

( while sleep 5; do date; done ) <&- >output.txt & 

When you then close your session, the job will continue to run as evidenced by the output.txt file (which has buffering so it takes a while to show non-zero). Don't forget to kill your job after testing :-)

So all you need to do is close stdin and background the job. To be really good, first cd to / so you don't hold on to a mount.

This works even in simple sh under Solaris.

Here's a way to daemonize any shell process, no external programs needed:

( while sleep 5; do date; done ) <&- >output.txt & 

When you then close your session, the job will continue to run as evidenced by the output.txt file (which has buffering so it takes a while to show non-zero). Don't forget to kill your job after testing.

So all you need to do is close stdin and background the job. To be really good, first cd / so you don't hold on to a mount.

This works even in simple sh under Solaris.

Source Link
w00t
  • 615
  • 8
  • 14

Here's a way to daemonize any shell process, no external programs needed:

( while sleep 5; do date; done ) <&- >output.txt & 

When you then close your session, the job will continue to run as evidenced by the output.txt file (which has buffering so it takes a while to show non-zero). Don't forget to kill your job after testing :-)

So all you need to do is close stdin and background the job. To be really good, first cd to / so you don't hold on to a mount.

This works even in simple sh under Solaris.