Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- sub cmd_penis{
- my($server, $witem) = @_;
- # Each bar is 6 hours (21600 seconds)
- my($up) = getuptime();
- my($timestr) = gettimestr($up);
- my($units) = "=" x int($up / 21600);
- my($sys) = `uname`;
- chomp($sys);
- $sys =~ tr/a-z/A-Z/;
- if($sys eq "LINUX") {
- $sys = "LUNIX";
- }
- print("$sys System Penistime: (_(_)".$units."D~ ($timestr)\n");
- }
- sub getuptime {
- open(UPTIME, "uptime|");
- chomp(my($up) = <UPTIME>);
- close(UPTIME);
- $up =~ s/.*up (.*), \d+ user.*/$1/;
- my($secs) = 0;
- if($up =~ /(\d+) days\,?/) {
- $up =~ s/(\d+) days\,?//;
- $secs += $1 * 24 * 60 * 60;
- }
- if($up =~ /(\d+) mins\,?/) {
- $up =~ s/(\d+) mins\,//;
- $secs += $1 * 60;
- }
- if($up =~ /(\d+):(\d+)/) {
- $up =~ s/(\d+):(\d+)//;
- $secs += $1 * 60 * 60;
- $secs += $2 * 60;
- }
- return $secs;
- }
- sub gettimestr {
- my($up) = $_[0]; # Seconds of uptime
- my(@tmp);
- $tmp[5] = "";
- # Years
- $tmp[4] = int($up/31536000);
- if($tmp[4] > 0) {
- $up -= $tmp[4]*31536000;
- $tmp[5] .= "$tmp[4]y ";
- }
- # Weeks
- $tmp[3] = int($up/604800);
- if($tmp[3] > 0) {
- $up -= $tmp[3]*604800;
- $tmp[5] .= "$tmp[3]w ";
- }
- # Days
- $tmp[2] = int($up/86400);
- if($tmp[2] > 0) {
- $up -= $tmp[2]*86400;
- $tmp[5] .= "$tmp[2]d ";
- }
- # Hours
- $tmp[1] = int($up/3600);
- if($tmp[1] > 0) {
- $up -= $tmp[1]*3600;
- $tmp[5] .= "$tmp[1]h ";
- }
- # Minutes
- $tmp[0] = int($up/60);
- if($tmp[0] > 0) {
- $up -= $tmp[0]*60;
- $tmp[5] .= "$tmp[0]m ";
- }
- # Seconds
- if($up > 0) {
- $tmp[5] .= "${up}s ";
- }
- $up = $tmp[5];
- $up =~ s/\s$//;
- return($up);
- }
- cmd_penis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement