Error:

# /etc/init.d/cdp-agent status
/etc/init.d/cdp-agent status: cdp (pid 10436?) not running

When checking the r1soft logs we get the exact error .

The error would be like as follows:
============
,[ERROR],[NO-CONNECTION],Exception from network
server: Address already in use
============

The issue can be sorted out by using the following steps.

If your Agent hangs up and is not restarting properly,
check Agent port is used by hcp demon

lsof -i :1167

#1167 default agent port

~]# lsof -i :1167
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
hcp_io/1/ 2250 root 8u IPv4 191316993 TCP *:1167 (LISTEN)
hcp_io/1/ 2256 root 8u IPv4 191316993 TCP *:1167 (LISTEN)
hcp_io/1/ 2257 root 8u IPv4 191316993 TCP *:1167 (LISTEN)
hcp_io/1/ 2258 root 8u IPv4 191316993 TCP *:1167 (LISTEN)

you see that hcp working so , you must stop hcp activity :

hcp -r /dev/hcp1 (/dev/hcp1 : example)

now ! you can restart agent easily :
/etc/init.d/cdp-agent restart

check the status now

# /etc/init.d/cdp-agent status
/etc/init.d/cdp-agent status: cdp (pid 10238) running

 

done.