Scenario: I'm using relayd as transparent proxy
and block some sites in work time, so I have two configs:

# cat /etc/relayd.conf
prefork 5
http protocol httpfilter {
        tcp { nodelay, sack, socket buffer 65536, backlog 1000 }
        return error
        request header filter "*youtube.com*" from "Host"
        ....
        header change "Connection" to "close"
}
relay httpproxy {
        listen on 127.0.0.1 port 8080
        protocol httpfilter
        forward to destination
}
# cat /etc/relaydfree.conf
prefork 5
http protocol httpfilter {
        tcp { nodelay, sack, socket buffer 65536, backlog 1000 }
}
relay httpproxy {
        listen on 127.0.0.1 port 8080
        protocol httpfilter
        forward to destination
}

Executing "relayd -f /newconfig" at specified time have not the same result as for example "pfctl -f /newconfig".
New number of relayd process were started instead of apply new config.

I've add this to cron:
0 9 * * 1-5 /usr/bin/pkill relayd && sleep 3 && /usr/sbin/relayd -f /etc/relayd.conf 0 12 * * 1-5 /usr/bin/pkill relayd && sleep 3 && /usr/sbin/relayd -f /etc/relaydfree.conf 0 13 * * 1-5 /usr/bin/pkill relayd && sleep 3 && /usr/sbin/relayd -f /etc/relayd.conf 0 18 * * 1-5 /usr/bin/pkill relayd && sleep 3 && /usr/sbin/relayd -f /etc/relaydfree.conf

But unfortunately this cause a trouble due pkill can't shutdown all relayd instances. "relayctl stop" and "kill -15 `pgrep relayd`" also don't work and have same result:

# ps -aux | grep relayd
_relayd 30639 99.0 0.3 6960 5192 ?? R/1 1:00PM 10:09.65 relayd: relay (relayd) _relayd 25093 50.1 0.3 7200 5568 ?? R/0 1:00PM 26:29.77 relayd: relay (relayd) _relayd 4696 49.0 0.3 6936 5432 ?? R/0 1:00PM 48:01.41 relayd: relay (relayd) root 18847 0.0 0.1 1236 1876 ?? Is 1:00PM 0:00.01 relayd: parent (relayd) _relayd 1306 0.0 0.1 808 1648 ?? I 1:00PM 0:00.00 relayd: hce (relayd) _relayd 4036 0.0 0.3 7176 5596 ?? S 1:00PM 0:02.17 relayd: relay (relayd) _relayd 32523 0.0 0.1 2280 2552 ?? S 1:00PM 0:00.21 relayd: relay (relayd) _relayd 636 0.0 0.1 1132 2020 ?? S 1:00PM 0:00.01 relayd: pfe (relayd) root 29834 0.0 0.0 876 4 p0 R+/1 3:29PM 0:00.00 grep relayd (ksh)
# kill -15 `pgrep relayd`
# ps ax | grep relayd
30639 ??  R/0    12:32.21 relayd: relay (relayd)
 4696 ??  R/0    49:31.75 relayd: relay (relayd)
25093 ??  R/1    27:54.53 relayd: relay (relayd)

Is there a way to don't use:

kill -9 `pgrep relayd` && relayd -f /newconfig

or it's a normal to use kill -9 for relayd.

Reply via email to