Star Hype News.

Premium celebrity moments with standout appeal.

updates

Can process be reloaded by PID?

By James Williams

I run a daemon which cannot be restarted via init.d or service command.

Is there a way to restart a process just by passing a process id to some command?

4

2 Answers

Killing or Reconfiguring a Daemon without Restarting

kill -HUP 1721

Restarts the process 1721 by sending the hangup signal.

killall -HUP inetd

Causes the daemon to reload its config file by sending the hangup signal.

killall -1 inetd 

Restarts inetd by sending signal number 1 which is the hangup signal.

The difference between this example and the previous one is the signal is called by name here rather than number.

Reference:

3

you can use the following command

CMD=`cat /proc/1234/cmdline |sed 's/\x0/ /g'` && kill 1234 && `$CMD` &

where 1234 is the process id.

What this line does is that first it copies the command line that was used to run that process into a variable, then it kills that process and restarts it using the stored command line.

Update: above command line has been updated

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy