Last active
February 8, 2018 22:53
-
-
Save HandyMenny/b5c36ceb293509b73f9f3c7f03cd7bae to your computer and use it in GitHub Desktop.
This file contains 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 | |
#Set _LOG to false to disable logging feature | |
_LOG=true | |
export PATH=/home/bin:/home/scripts:/opt/bin:/bin:/sbin:/usr/bin:/usr/sbin | |
export LD_LIBRARY_PATH=/lib/public:/lib/private:/usr/lib:/lib:/usr/lib/ebtables: | |
PROCESS="/usr/bin/ap_steer" | |
USER_CONFIG="/home/root/data/ap_steer.conf" | |
SYSLOG_CONF="/etc/syslog-ng/syslog-ng_ap.conf" | |
LOG_FILE="/var/run/ap_steer.log" | |
if [ -e ${USER_CONFIG} ]; then | |
CONFIG=${USERCONFIG} | |
else | |
CONFIG="/etc/ap_steer.conf" | |
fi | |
case "$1" in | |
start) | |
killall ${PROCESS##*/} | |
#Kill the right syslog-ng | |
ps | grep ${SYSLOG_CONF} | grep -v grep | awk '{print $1}' | xargs kill -9 | |
if [ "$_LOG" = true ]; then | |
if ! [ -e ${LOG_FILE} ]; then | |
#Create named pipe | |
mkfifo ${LOG_FILE} | |
fi | |
#We need two syslog because /var/syslog-ng.conf seems to be created by some binary | |
/usr/sbin/syslog-ng -f ${SYSLOG_CONF} | |
else | |
LOG_FILE="/dev/null" | |
fi | |
exec ${PROCESS} -c ${CONFIG} > ${LOG_FILE} & | |
exit 0 | |
;; | |
stop) | |
killall ${PROCESS##*/} | |
#Kill the right syslog-ng | |
ps | grep ${SYSLOG_CONF} | grep -v grep | awk '{print $1}' | xargs kill -9 | |
exit 0 | |
;; | |
*) | |
echo "$0: unrecognized option $1" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment