Skip to content

Instantly share code, notes, and snippets.

@h3
Last active December 18, 2015 23:49
Show Gist options
  • Save h3/5864091 to your computer and use it in GitHub Desktop.
Save h3/5864091 to your computer and use it in GitHub Desktop.
Try networking configuration and set a restore time (tested on Ubuntu)
#/bin/sh
RESTART="/etc/init.d/networking restart"
FILEPATH="/etc/network/interfaces"
BACKUPPATH="$FILEPATH.BAK"
RESET_TIME="now + ${1:-5min}"
sudo cp -fp $FILEPATH $BACKUPPATH && \
sudoedit $FILEPATH && \
sudo bash -c "echo 'cp -fp $BACKUPPATH $FILEPATH && $RESTART' | at $RESET_TIME" && \
sudo $RESTART
@h3
Copy link
Author

h3 commented Jun 26, 2013

Usage:

$ chmod a+x ./trynetconf
$ ./trynetconf.sh 1min
$ trynetconf 1min

System integration:

$ mv trynetconf.sh /usr/local/bin/trynetconf
$ chmod a+x /usr/local/bin/trynetconf
$ trynetconf 1min

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment