This article covers how a specific process can be restarted in Junos OS without rebooting the router.
To restart a specific process, first, find out which processes are running by using the CLI command show system process from operational mode.
show system process
root@Router> show system processes extensive | match kmd 10020 root 2 0 6008K 4816K select 0:00 0.00% 0.00% kmd
In this example, we will restart the Key Management Daemon (kmd), which is responsible for running IPSec.
root@Router> restart ipsec-key-management immediately
Issue the CLI command show system process from operational mode again.
root@Router> show system processes extensive | match kmd 10215 root 2 0 6008K 4792K select 0:00 10.15% 1.42% kmd
In the example above, you can see that the Process ID (pid) has changed after the restart from 10020 to 10215. The pid changes to a new one once the process is restarted.
You can also restart a process from shell mode too.
> start shell user root Password:
Enter the root password. When you are in shell mode, enter the process that you want to restart.
For example, you want to restart the alarmd process.
root@SRX1:~ # ps -aux | grep alarmd USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND root 6644 0.0 1.2 739672 11068 - S 03:47 0:08.78 /usr/sbin/alarmd -N
Kill the process ID (6644 in this example) by using the following command:
root@SRX1:~ # kill -9 6644
Issue the shell mode command " ps -aux | grep alarmd" again.
ps -aux | grep alarmd"
root@srx1% ps -aux | grep alarmd root 1161 0.0 0.2 6820 3500 ?? S 4:49AM 0:04.69 /usr/sbin/alarmd -N
In the example above, you can see that the Process ID (pid) has changed after the restart from 6644 to 1161. The pid changes to a new one once the process is restarted.
The third option to restart a process is by using the CLI command "request system process terminate <PID>"
root@Router> show system processes extensive | match ssh 90215 root 2 0 1008K 1792K select 0:00 10.15% 1.42% sshd> request system process terminate 10215
root@Router> show system processes extensive | match ssh 90411 root 2 0 1008K 1792K select 0:00 10.15% 1.40% sshd
--> Additional information about SIGHUP and SIGHKILL:
SIGHUP on Junos
General Behavior
On Junos, SIGHUP (signal 1) usually triggers a graceful daemon restart or configuration reload, depending on the process.
Most Junos processes are monitored by:
When a daemon receives SIGHUP:
Examples in Junos
Junos guarantees
SIGKILL on Junos
SIGKILL (signal 9) forcefully terminates the process immediately.
On Junos:
Effects on Junos
Force-killing a daemon can produce:
Examples
Sending SIGHUP to a Junos daemon is safe.
It is commonly used for:
Sending SIGKILL should only be done under TAC guidance.
It can cause:
2020-06-30: Article now covers restarting a process from CLI as well as shell mode. This article is complete and accurate. '
2024-12-27 : Added a third option to restart a process or terminate an existing process