Hello everyone. I am quite new to julia and it’s multiprocessing model.
What I need is a way to make a demonized process in julia.
In python I have done it through double fork but I have not been able to find a way for it in julia.
I basicly need to have a long running process in background and detached from terminal that should be able to use sockets to send and receive information.
Any help would be much appreciated.
Thanks
Tasks are a control flow feature that allows computations to be suspended and resumed in a flexible manner. This feature is sometimes called by other names, such as symmetric coroutines, lightweight threads, cooperative multitasking, or one-shot continuations. Tasks provide concurrency within one thread.
You can also launch a work on a separate process, see here.
There is also multi-threading but it is experimental, and probably not your best choice.
Like python, you can just fork again:
spawn(`$(Base.julia_cmd()) -e "subcommand"`)
exit(0)
Or at the terminal, you can also just run it in the background, without completely detaching control (by adding &
, or hitting ^Z
and then running bg 1
)
As an aside, I think most recent service management (such as launchd and systemd) now handle this, and prefer that you don’t double-fork and daemonize though.
Thanks @jameson
That was helpful.
However after some research I realized that using systemd is better and it is not that difficult too. I am going to give it a try.
Thanks