Saving virtualmin login info to text file

Hi,

I’m trying to find a way save details for every virtualmin successful login. I see a similar topic here, but unfortunately I cannot replicate https://www.virtualmin.com/comment/571882

The first thing is the login_script parameter already exists in the file /etc/webmin/miniserv.conf, it is login_script=/etc/webmin/login.pl, should I add another line login_script=/etc/webmin/script.sh ?

Any way, I tried it, and here is the content if the script.sh file

#!/usr/bin/perl

use strict;
use warnings;
use LWP::Simple;

my $filename = “/etc/testing.txt”;
open my $fh, “>”, $filename or die(“Could not open file. $!”);
my $xml = $ARGV[0];
print $xml;
print $fh $xml;
close $fh;

$ARGV[0] should be the username as mentioned in the reference link.

After saving the script file and the miniserv.conf file, I restarted webmin. But after logging in, the file /etc/testing.txt is not created.

What would be the reason, and how to fix this? Is there any log file to check any error with the perl scripts?

Thank you very much for any help.