-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add replaceIp function and use it to update IP address in restart.sh
- Loading branch information
1 parent
944a7c7
commit 46c2668
Showing
2 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
replaceIp() { | ||
FILE="/etc/tunnel" | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: replace_ip OLD_IP NEW_IP" | ||
return 1 | ||
fi | ||
|
||
oldIp=$1 | ||
newIp=$2 | ||
|
||
if [ -f "$FILE" ]; then | ||
sudo sed -i "s/$newIp/$oldIp/g" "$FILE" | ||
echo "IP address has been successfully replaced." | ||
else | ||
echo "Error: File $FILE does not exist." | ||
return 1 | ||
fi | ||
} |
This file contains 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