#!/usr/bin/perl -w #example samba-user checker use strict; my $user; my $pid; my $loginname; my $machine; my $dow; my $mon; my $day; my $time; my $year; my $string; my $uptime; # first filter out the relevant userinfo: open SMB, "smbstatus -b|grep :|"; while(<SMB>){ ($pid,$loginname,$machine,$dow,$mon,$day,$time,$year) = split /\s+/, $ +_, 8; print "$loginname logged in on machine: $machine (login: $mon $day - $ +time)\n"; $user++; } close SMB; print "\ntotal users: $user\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using smbstatusinfo in scripts
by teabag (Pilgrim) on Apr 08, 2003 at 15:57 UTC | |
|
Re: Using smbstatusinfo in scripts (improved)
by Aristotle (Chancellor) on Apr 07, 2003 at 16:07 UTC |