From 44f1651692a91c1f644bcae217a19d40c5bc9b65 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 20 Apr 2009 01:42:05 -0700 Subject: add env override for default session id --- scripts/vyatta-cfg-cmd-wrapper | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'scripts/vyatta-cfg-cmd-wrapper') diff --git a/scripts/vyatta-cfg-cmd-wrapper b/scripts/vyatta-cfg-cmd-wrapper index 8eddd5c..e994742 100755 --- a/scripts/vyatta-cfg-cmd-wrapper +++ b/scripts/vyatta-cfg-cmd-wrapper @@ -35,9 +35,16 @@ export VYATTA_EDIT_LEVEL=/; export VYATTA_TEMPLATE_LEVEL=/; export VYATTA_ACTIVE_CONFIGURATION_DIR=/opt/vyatta/config/active; -export VYATTA_CHANGES_ONLY_DIR=/tmp/changes_only_$PPID; -export VYATTA_TEMP_CONFIG_DIR=/opt/vyatta/config/tmp/new_config_$PPID; -export VYATTA_CONFIG_TMP=/opt/vyatta/config/tmp/tmp_$PPID; +# allow env variable to override default session id (ppid). this enables +# the script to handle cases where the invocations can come from +# different parents. +SID=$PPID +if [ -n "$CMD_WRAPPER_SESSION_ID" ]; then + SID=$CMD_WRAPPER_SESSION_ID +fi +export VYATTA_CHANGES_ONLY_DIR=/tmp/changes_only_$SID; +export VYATTA_TEMP_CONFIG_DIR=/opt/vyatta/config/tmp/new_config_$SID; +export VYATTA_CONFIG_TMP=/opt/vyatta/config/tmp/tmp_$SID; RET_STATUS=0 -- cgit v1.2.3