networking.sh.svn-base

来自「asterisk-gui asterisk网关接口编程 控制asterisk的接」· SVN-BASE 代码 · 共 64 行

SVN-BASE
64
字号
#!/bin/sh# Copyright (C) 2007, Digium, Inc.## Brandon Kruse <bkruse@digium.com>## Script to apply network settings from the GUI.WAN_INTERFACE="eth0"  # default value, will be replaced by the value from network.paramsDHCPD_CONFIG="/etc/udhcpd.conf"DHCPD_BIN="`which udhcpd`"DHCPD_PROCNAME="udhcpd"NTP_CONFIG="/etc/config/ntp.conf"ARG_FILE="/etc/asterisk/scripts/network.params"# We are going to set default valuesif [ -f ${ARG_FILE} ]; then	echo "Configuring with network.params"	. ${ARG_FILE} 	# Include the file that has the variables in it, written from the GUI.else	echo "Configuring interface for the first time, or after configuration loss."	DHCP_WAN_PROVISION=off	TFTP_LAN=http://0.0.0.0:8088/phoneprovfi# Now for the real logic in the script.# Note: You CANNOT use functions with msh/busybox.# Set our time serverkillall -9 ntpd 2>/dev/nullecho "### Autogenerated conf file" > ${NTP_CONFIG}echo "" >> ${NTP_CONFIG}if [ "${NTP_ADDRESS}" != "" ]; then	ntpdate ${NTP_ADDRESS} 	echo "server   ${NTP_ADDRESS}" >> ${NTP_CONFIG}fiecho "server 127.127.1.1 prefer iburst" >> ${NTP_CONFIG}echo "fudge 127.127.1.1 stratum 5" >> ${NTP_CONFIG}echo "" >> ${NTP_CONFIG}echo "disable auth" >> ${NTP_CONFIG}#daemon is started as last thing in scriptif [ "${DHCP_WAN_PROVISION}" = "on" ]; then	echo "Setting limited udhcpd on WAN for provisioning"# Now we will edit /etc/udhcpd.conf	echo "interface ${WAN_INTERFACE}" > ${DHCPD_CONFIG}# Set leases to 0 so that IP Offers will not be sent out	echo "max_leases 0" >> ${DHCPD_CONFIG}	if [ "${TFTP_LAN}" != "" ]; then		echo "opt tftp ${TFTP_LAN}" >> ${DHCPD_CONFIG}	fi	echo "opt ntpsrv 0.0.0.0" >> ${DHCPD_CONFIG}# Stop and restart our dhcp server.	killall -9 ${DHCPD_PROCNAME} 2> /dev/null	${DHCPD_BIN} > /dev/null 2> /dev/null &else 	echo "There is NO udhcpd"	killall -9 ${DHCPD_PROCNAME} 2> /dev/nullfi#Finish ntp daemon work. ntpd -g &

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?