aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-06-04 20:55:28 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-06-04 20:55:28 +0200
commit3ddb341f412d044643b00e7eb71618b0f20ee602 (patch)
treeb698d5964ddbbba0782e40eb98a065a6379edff6
parent95beffcb8b8e69afdf2b83dfe5c4b01e515c67d6 (diff)
download0tdns-3ddb341f412d044643b00e7eb71618b0f20ee602.tar.gz
0tdns-3ddb341f412d044643b00e7eb71618b0f20ee602.zip
tag namespace name with more unique shell's PID instead of timestamp
-rwxr-xr-xsrc/vpn_wrapper.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vpn_wrapper.sh b/src/vpn_wrapper.sh
index b4b9350..5d6b034 100755
--- a/src/vpn_wrapper.sh
+++ b/src/vpn_wrapper.sh
@@ -4,12 +4,11 @@ OPENVPN_CONFIG="$1"
# rest of args is the command to run in network namespace
shift
-# just in case something causes more instances of this script
-# to run simultaneously, we timestamp some names
-SECONDS=`date '+%s'`
+# to enable multiple instances of this script to run simultaneously,
+# we tag namespace name and file names with this shell's PID
-HELPER_SCRIPT=/var/lib/0tdns/helper_script$SECONDS.sh
-NAMESPACE_NAME=0tdns$SECONDS
+HELPER_SCRIPT=/var/lib/0tdns/helper_script$$.sh
+NAMESPACE_NAME=0tdns$$
# we create another script as a way of passing variables
# to netns-script