#==============================================================
#
#  Abs:  Startup Script for Shared Platform (dev)
#
#  Name: st.cmd
#
#  Desc: The processor is an Advantech 1U server,
#        SKY-8100 industrial pc/server.
#
#  Facility:  EED Shared Platform
#
#  Auth: dd-mmm-yyyy, Author's Name   (USERNAME)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        11-Jun-2020, K. Luchini      (LUCHINI):
#         extracted from $EPICS_IOCS/cpu-b84-sp05/kernel-modules.cmd
#         and renamed to st.cmd
#
#==============================================================

# =========================================
# Turn on local IPMI Client support
# =========================================
echo "Load IPMI..."
modprobe ipmi_devintf
ipmitool lan print

# =========================================
# Network configuration
# =========================================
# Enable Ethernet SFP+ Top For Advantech 1U
ifconfig eth5 10.0.1.1 netmask 255.255.255.0 up

# ==================================================================
# escalating RT priority for network kernel threads (SCHED_FIFO, 84)
# =================================================================
for PID in  $(ps -elF | grep eth5 | grep -v grep | awk '{print $4}'); do chrt -f -p 84 $PID ; done

# =========================================
# Start DHCP server on eth0
# =========================================
DHCPD_IF=eth0
/sbin/ifconfig $DHCPD_IF 192.168.1.1 netmask 255.255.255.0 up
. dhcpdStartup.sh $DHCPD_IF

# ======================================
# increasing receive buffer size to 10MB
# ======================================
sysctl -w net.core.rmem_default=10485760

# wait a bit to device become visible
sleep 2

# End of script'


