Skip to content

Instantly share code, notes, and snippets.

@h3

h3/trynetconf.sh

Last active Dec 18, 2015
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@h3 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