75 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
 | 
						|
# ---
 | 
						|
# - Install scripts
 | 
						|
# ---
 | 
						|
 | 
						|
cp <path-to-check_net.sh> /usr/local/sbin/
 | 
						|
cp <path-to-netconfig.sh> /usr/local/sbin/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
# ---
 | 
						|
# - Configuration 
 | 
						|
# ---
 | 
						|
 | 
						|
mkdir -p /etc/check_net
 | 
						|
cp <path-to-check_net.conf> /etc/check_net/check_net.conf
 | 
						|
 | 
						|
# - Adjust /etc/check_net/check_net.conf
 | 
						|
# -
 | 
						|
vim /etc/check_net/check_net.conf
 | 
						|
 | 
						|
 | 
						|
 | 
						|
# ---
 | 
						|
# - systemd configuration for service "check_net"
 | 
						|
# ---
 | 
						|
 | 
						|
# - Create service "check_net"
 | 
						|
# -
 | 
						|
cat <<EOF > /etc/systemd/system/check_net.service
 | 
						|
[Unit]
 | 
						|
Description=Configure Routing for Internet Connections;
 | 
						|
After=network.target
 | 
						|
After=rc-local.service
 | 
						|
 | 
						|
[Service]
 | 
						|
ExecStart=/usr/local/sbin/check_net.sh
 | 
						|
ExecStartPre=rm -rf /tmp/check_net.sh.LOCK
 | 
						|
ExecStopPost=rm -rf /tmp/check_net.sh.LOCK
 | 
						|
KillMode=control-group
 | 
						|
SendSIGKILL=yes
 | 
						|
TimeoutStopSec=2
 | 
						|
Restart=on-failure
 | 
						|
 | 
						|
[Install]
 | 
						|
WantedBy=multi-user.target
 | 
						|
EOF
 | 
						|
 | 
						|
 | 
						|
# - Activate service check_net
 | 
						|
# -
 | 
						|
systemctl enable check_net.service
 | 
						|
 | 
						|
systemctl daemon-reload
 | 
						|
 | 
						|
systemctl start check_net
 | 
						|
 | 
						|
 | 
						|
# ---
 | 
						|
# - Configure lograotation for service "check_net"
 | 
						|
# ---
 | 
						|
 | 
						|
cat <<EOF > /etc/logrotate.d/check_net
 | 
						|
/var/log/check_net.log
 | 
						|
{
 | 
						|
   rotate 7
 | 
						|
   daily
 | 
						|
   missingok
 | 
						|
   notifempty
 | 
						|
   copytruncate
 | 
						|
   delaycompress
 | 
						|
   compress
 | 
						|
}
 | 
						|
EOF
 |