I need to send a kill -1 to a process but I can not get the pid from a file as it's location is different on some systems
On Linux systems, that's very simple. You said your executable is "dnsmasq", so you can simply do:
killall -s 1 dnsmasq
If this isn't a Linux system or if you need the capture the PID for other reasons, do something like:
THEPID=`ps -ef|grep dnsmasq |grep -v grep`
and reference $THEPID wherever you need to.
If you found something useful today, please consider a small donation.
Got something to add? Send me email.
More Articles by Anthony Lawrence © 2015-07-30 Anthony Lawrence
What do such machines really do? They increase the number of things we can do without thinking. Things we do without thinking — there's the real danger. (Frank Herbert)