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} user@10.0.0.1:~/Log