troubleshooting Question

perl solaris logged in script

Avatar of atom_jelly
atom_jellyFlag for United States of America asked on
Unix OSPerlScripting Languages
3 Comments1 Solution981 ViewsLast Modified:
okay I found this perl script then I name is I want to use this script to tell me how long someone has been logged in. Look at my example below. I need help. Thanks.

use Time::Local;
$current = time();
print "$current\n";

(exec /export/home/reports/;last –a) |awk '(NR==1){n=$1;next}/still /{u=$1;printf("/usr/ucb/echo -n %s-;exec /export/home/reports/ "%s %s %s %s\" +%s-%%s\n",%u,$3,$4,$5,$6,n) ; }'|sh| awk -F"-" ' {printf("env TZ=GMT printf " user %s  logged in for %d days, %d hours, %d minutes and %d seconds\n", $1, $2-$3)}’|sh

I want to see

user gumby has been logged in for HOURS Minutest and Seconds.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros