Created
July 31, 2018 13:27
-
-
Save jqqqqqqqqqq/a2dee7e3696a9a5a7a19c1ed7b7247e1 to your computer and use it in GitHub Desktop.
bird2 init.d script with restart option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
# Copyright (C) 2010-2017 OpenWrt.org | |
USE_PROCD=1 | |
START=70 | |
BIRD_BIN="/usr/sbin/bird" | |
BIRD_CONF="/etc/bird.conf" | |
BIRD_PID_FILE="/var/run/bird.pid" | |
start_service() { | |
mkdir -p /var/run | |
procd_open_instance | |
procd_set_param command $BIRD_BIN -c $BIRD_CONF -P $BIRD_PID_FILE | |
procd_set_param file "$BIRD_CONF" | |
procd_set_param stdout 1 | |
procd_set_param stderr 1 | |
procd_set_param respawn | |
procd_close_instance | |
} | |
stop_service() { | |
kill $(cat $BIRD_PID_FILE) | |
rm -f $BIRD_PID_FILE | |
} | |
#stop_service重新定义,退出服务器后需要做的操作 | |
restart() { | |
stop | |
start | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment