Rio
Rio

Reputation: 17

Cannot kill the process and start the same process using script

I am trying to kill a process and start the same process.

When I kill the process using pkill on the command-line and start the service using nsd, it works just fine. But when I use the same command in my script it shows following errors:

nsd[18652]: notice: nsd starting (NSD 4.1.15)

nsd[18652]: error: can't bind udp socket: Address already in use

nsd[18652]: error: server initialization failed, nsd could not be started

error: connect (127.0.0.1@8952): Connection refused

script.sh contains

pkill nsd

nsd

nsd-control reload

Upvotes: 0

Views: 328

Answers (1)

Cyrus
Cyrus

Reputation: 88553

pkill nsd

# wait until nsd has disappeared
while pgrep nsd; do sleep 1; done

nsd
nsd-control reload

Upvotes: 2

Related Questions