I need to get PID of web application that runs with the command
/usr/bin/vibe, to run it as a service. Tell me please, how this
can be done.
Am 09.06.2012 21:13, schrieb Valery:
Now I think it is too difficult, the process is started from the
generated script, not via rdmd :(
If you need the PID after startup, you could just write it to a file
from inside the application:
import vibe.d;
import std.process;
int main()
{
// ...
auto f = openFile("/tmp/myapp.pid", FileMode.CreateTrunc);
f.write(to!string(getpid()));
f.close();
// ...
}
otherwise you can call 'vibe' to just compile the app and then run it
manually:
$ vibe build
$ ./app &
$ echo "PID: $$"
Regards,
Sönke
On Sunday, 10 June 2012 at 08:23:44 UTC, Sönke Ludwig wrote:
Am 09.06.2012 21:13, schrieb Valery:
Now I think it is too difficult, the process is started from
the
generated script, not via rdmd :(If you need the PID after startup, you could just write it to
a file from inside the application:import vibe.d;
import std.process;int main()
{// ... auto f = openFile("/tmp/myapp.pid", FileMode.CreateTrunc); f.write(to!string(getpid())); f.close(); // ...
}
otherwise you can call 'vibe' to just compile the app and then
run it
manually:$ vibe build
$ ./app &
$ echo "PID: $$"Regards,
Sönke
This is one of the methods, but can you get PID from the outside?