Skip to content

Commit

Permalink
fix(): Add trap to restore resolv.conf.backup on SIGINT (#32)
Browse files Browse the repository at this point in the history
* add trap to restore resolv.conf.backup  on SIGINT

Edit last echo of trap to be prettier a bit.
  • Loading branch information
BrPrS authored Jul 15, 2024
1 parent ae3317c commit 953dcf3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions best403unlocker
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
DATABASE=best403unlocker_database_$(date +%s)
DATABASE_PATH=/tmp/$DATABASE
trap 'echo -e "\n";sudo cat /etc/resolv.conf.bakup > /etc/resolv.conf;rm /etc/resolv.conf.bakup; echo -e "/etc/resolv.conf is changed to default.\nExiting..."; exit' SIGINT
# Functions
check_run_with_root_accsses(){
if [ "$EUID" -ne 0 ]; then
Expand Down

0 comments on commit 953dcf3

Please sign in to comment.