Page MenuHomeVyOS Platform

Detect what conflicts with POSIX mode
Open, LowPublicBUG

Description

When running a script in /config/scripts/ directory getting an error:

test@R-01# sudo /config/scripts/getVpnUsers.sh
/opt/vyatta/share/vyatta-cfg/functions/interpreter/vyatta-cfg-run: line 161: `vyatta_config_commit-confirm': not a valid identifier

We tried to fix this line. Then we saw error in a different place:
/etc/bash_completion.d/vyatta-cfg: line 673: syntax error near unexpected token `<'

I think this kind of problem can be in different places.

I am sharing one of the scrips which may be helpful:

#!/bin/vbash
source /opt/vyatta/etc/functions/script-template

if [ "$(id -g -n)" != 'vyattacfg' ] ; then
    exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi

# Initialize Globals
HOME_DIR=~
VERSION_SYSTEM="v1.0.0 :"
date=$(date +"%Y-%m-%d %H:%M")
date_short=$(date +"%Y-%m-%d")
log_path="/config/logs"
logfile="${log_path}/remote_user_access_${date_short}.log"

# Set up Log file
if [[  ! -f ${logfile} ]]; then
  touch ${logfile}
  echo ${VERSION_SYSTEM} >> ${logfile}
  fi

# Get current users and append to log file
echo "BEGIN: Measurement taken at: ${date}" >> ${logfile}
run show vpn remote-access >> ${logfile}
echo "END: " >> ${logfile}
exit

scp ${logfile} [email protected]:~/Log

Details

Difficulty level
Unknown (require assessment)
Version
1.3.2 and 1.3.3
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

What is the purpose of:

if [ "$(id -g -n)" != 'vyattacfg' ] ; then
    exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi

and how does your script work if you comment that out?

Viacheslav changed the subtype of this task from "Task" to "Bug".Aug 14 2023, 11:17 AM
a.hajiyev updated the task description. (Show Details)