Skip to content

Commit 150ed3e

Browse files
author
duanhongyi
committed
fix reload bug
1 parent 80079ae commit 150ed3e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

rootfs/etc/systemd/system/smartdns.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ After=network.target
55
[Service]
66
User=root
77
Group=root
8-
WorkingDirectory={smartdns_path}
8+
WorkingDirectory=/usr/local/smartdns/script
99
ExecStart=/bin/sh run_dns.sh
10-
ExecReload=/bin/kill -s HUP $MAINPID
10+
ExecReload=/bin/sh reload_dns.sh
1111
ExecStop=/bin/kill -s TERM $MAINPID
1212
EnvironmentFile=/etc/environment
1313
PrivateTmp=true

script/reload_dns.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
filepath=$(cd "$(dirname "$0")"; pwd)
6+
7+
chmod a+r $filepath/../sdns.pid &>/dev/null
8+
pid=`cat $filepath/../sdns.pid 2>/dev/null`
9+
kill -s HUP ${pid}

0 commit comments

Comments
 (0)