You are not logged in.

#1 2006-09-29 07:51:03

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Starting a program and remembering its pid.

I'd like making a package for the abyss web server X1.
And since it is a server, I'd like making a /etc/rc.d/'s script. Taking as base one of the existing scripts it will be easy.

But I have a problem I'd like starting the server in the background, save its pid somewhere for closing it cleanly (via kill -2) when stopping. How can I do that? I saw pid related manuals, but I got confused.

Also, it would be good (safer at least) starting the server as unprivilegiated user. atm I am using:
su --shell=/bin/sh -c'/usr/bin/abyssws' nobody
but it starts sh with abyssws inside. Can't I fork it to background?

thanks everyone.

P.S. If I manage making a decent package, should I submit it to aur?

Offline

#2 2006-09-29 08:34:40

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Starting a program and remembering its pid.

someapplication & #start in background
echo "someapplication's pid = $!"

Offline

Board footer

Powered by FluxBB