Skip to content

Instantly share code, notes, and snippets.

@jqqqqqqqqqq
Created July 31, 2018 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jqqqqqqqqqq/a2dee7e3696a9a5a7a19c1ed7b7247e1 to your computer and use it in GitHub Desktop.
Save jqqqqqqqqqq/a2dee7e3696a9a5a7a19c1ed7b7247e1 to your computer and use it in GitHub Desktop.
bird2 init.d script with restart option
#!/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