Re: Client history

Peter Davis via Openvpn-users <[email protected]>
Newsgroups gmane.network.openvpn.user
Message-ID <uhYyT6tWcb2iq0Y8yWPrF-8t8bLut3zwRTC9oKKlwH8FZrTlTgxvx5LX8qzJYeD4qyQ5J1fGialu2sKRlPxkMGj28oQ3k3LE6uFKaN01YZA=@proton.me>
> On Sunday, February 25th, 2024 at 6:20 PM, Bo Berglund <[email protected]> wrote:

> On Sun, 25 Feb 2024 15:31:20 +0100, Bo Berglund [email protected] wrote:
> 
> > On Sun, 25 Feb 2024 10:50:05 +0000, Peter Davis via Openvpn-users
> > [email protected] wrote:
> > 
> > > Hello,
> > > I installed shellcheck and result is:
> > > 
> > > # shellcheck script-events.sh
> > > 
> > > In script-events.sh line 14:
> > > if [[ "$script_type" == "client-connect" ]]; then
> > > ^----------^ SC2154 (warning): script_type is referenced but not assigned.
> > > 
> > > In script-events.sh line 15:
> > > echo "$LOG_TIMESTAMP - $common_name connected with IP $trusted_ip" >> "$LOG_FILE"
> > > ^----------^ SC2154 (warning): common_name is referenced but not assigned.
> > > ^---------^ SC2154 (warning): trusted_ip is referenced but not assigned.
> > > 
> > > For more information:
> > > https://www.shellcheck.net/wiki/SC2154 -- common_name is referenced but not...
> > 
> > That is because shellcheck cammot find the assignments to these variables...
> > 
> > And that is because they are actually put into the environment by openvpn prior
> > to calling the script.
> > 
> > So these warnings are OK, since you know that on execution they will exist.
> > 
> > I use shellcheck to find other errors that are hard to find for example after
> > editing scripts of hundreds of lines in size. Esay to introduce unpaired if-fi
> > etc..
> > 
> > I find it very useful prior to doing a test run to weed out typos and missing
> > stuff like broken if fi pairs and mismatches of ( ) and [ ] etc.
> > 
> > The result above says that there is no problem with the script itself
> > syntactically, just that shellcheck does not know of the environment varibles
> > provided by the caller.
> 
> 
> HINT:
> -----
> If you do not want this particular message to appear in a shellcheck output then
> you can add the following comment to the script on line #2:
> 
> # shellcheck disable=SC2154
> 
> This will disable shellcheck from warning about these missing assignments.
> It makes sense to add into scripts that use variables supplied in the
> environment so this line could help in this case but not be used in other cases.
> 
> 
> --
> Bo Berglund
> Developer in Sweden
> 
> 
> 
> _______________________________________________
> Openvpn-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openvpn-users

Hi,
Thanks again.
But my problem is that the script doesn't work at all. How do I find the cause?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.