I’ve got an action problem that’s got me at my wit’s end. I have a list of some 4,000 accounts that need to be removed from many Linux servers being monitored by BigFix. It is a csv file in the form with each line in the form
servername,username
I have added this file to an action script using the createfile construct, and I write this to the servers, and then create a shell script to grep the file to pull the accounts for that server into another data file, and then run a perl script to parse that data file to remove the accounts. The code after creating and running the files is below.
EOFEOF
delete /tmp/AcctList.txt
copy __createfile /tmp/AcctList.txt
pause while {number of lines starting with "<END>" of file "/tmp/AcctList.txt" = 0}
// Account Name Check
delete createfile
createfile until end
grep --ignore-case "{computer name}," "/tmp/AcctList.txt" >"/tmp/Accts2Del.txt"
echo "DONE1" > "/tmp/Done1.txt"
end
delete /tmp/FindAcct.sh
copy __createfile /tmp/FindAcct.sh
wait chmod 777 "/tmp/FindAcct.sh"
wait su -c '/tmp/FindAcct.sh'
pause while {not exists file "/tmp/Done1.txt"}
delete createfile
createfile until EOFEOF
#!/usr/bin/perl
open DELUS, "<", "/tmp/Accts2Del.txt";
open DELLOG, ">>", "/tmp/DelLog.txt";
while (<DELUS>)
{
my $thisuser = $_;
chomp $thisuser;
$thisuser =~ s/{computer name},//g;
system ("userdel -r $thisuser");
print DELLOG "Deleted user $thisuser\n";
}
close DELUS;
close DELLOG;
open DONE, ">", "/tmp/Done2.txt";
print DONE "DONE";
close DONE;
EOFEOF
delete "/tmp/Done.txt";
delete "/tmp/Accts2Del.txt"
delete "/tmp/RemUsers.pl"
copy __createfile "/tmp/RemUsers.pl"
wait chmod 777 "/tmp/RemUsers.pl"
wait su -c '/tmp/RemUsers.pl'
pause while {not exists file "/tmp/Done2.txt"}
delete /tmp/RemUsers.pl
delete /tmp/FindAcct.sh
delete /tmp/Accts2Del.txt
delete /tmp/AcctList.txt
Now, the problem is, when I run the FindAcct.sh script, nothing is written to the Accts2Del.txt file, but the Done1.txt file is created, showing that the script did actually run. When I run the script from the server command, my test users do show up properly.
We are currently running BigFix version 9.2.3.68. Has this been fixed in a later version of the system? If not, how can I get this to run properly?
Thanks for you time and input on fixing this.