Created
September 16, 2020 16:32
-
-
Save jeffmccune/6653b1b4c4b0a206b934d065f13dac64 to your computer and use it in GitHub Desktop.
Stub IP to troubleshoot dhclient
This file contains hidden or 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/bash | |
if ! [[ -f /jeff/ip ]]; then | |
mkdir /jeff | |
mv /sbin/ip /jeff/ip | |
fi | |
cat <<"EOF" > /sbin/ip | |
#! /bin/bash | |
# | |
read -a st < /proc/$$/stat | |
read -a ppid < /proc/${st[3]}/stat | |
file=$(printf '/tmp/%06d_' $$) | |
/jeff/ip route list table all > ${file}_01_before.txt | |
echo "ip $@" > ${file}_02_command.txt | |
/jeff/ip "$@" | |
rval=$? | |
echo "rval=${rval}" > ${file}_03_rval.txt | |
/jeff/ip route list table all > ${file}_04_after.txt | |
# Write the checklist | |
echo " * [ ] \`$0 $*\` [**PID=${$}** PPID=${st[3]} ${ppid[1]}] (rval=${rval}) " >> /tmp/jeff.txt | |
exit $rval | |
EOF | |
chmod a+x /sbin/ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment