commit 3c43cdf2aed534b48bdff7260fe9166bd915a0b1
parent 68b0bb40e66c8c095e1b521989156c40f35d3cb2
Author: haris <haris@metal.lan>
Date: Fri, 25 Oct 2013 15:26:02 +0300
perley script added
Diffstat:
A | perley | | | 66 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 66 insertions(+), 0 deletions(-)
diff --git a/perley b/perley
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+# grep user
+chomp (my $username = qx(whoami));
+
+# grep OS
+chomp (my $os = qx(uname));
+
+# grep kernel version
+chomp (my $kernel = qx(sysctl | grep kern.version));
+my @kernel_split = split(/=/, $kernel);
+$kernel_split[1] =~ s/OpenBSD //g;
+my $kernel_out = substr($kernel_split[1], 0, -18);
+
+# grep hostname
+chomp (my $hostname = qx(hostname));
+
+# grep uptime and split the result
+chomp (my $up = qx(uptime));
+my @uptime = split(/,/, $up);
+# my $uptime_cut = substr($uptime[0], 12);
+my $uptime_cut = $uptime[0];
+$uptime_cut =~ s/^ //g;
+
+# grep ram and split
+# top -n | grep Memory and split that
+
+# grep shell
+chomp (my $shell = qx(echo \$SHELL));
+
+# grep RAM
+chomp (my $memory = qx(top -n | grep Memory));
+my @mem = split(/ /, $memory);
+
+# grep /home space
+chomp (my $space = qx(df -h | grep home));
+my @space_stripped = split(/ /, $space);
+my @home_space = split(/ /, $space_stripped[4]);
+$space_stripped[2] =~ s/^ //g;
+$space_stripped[3] =~ s/^ //g;
+
+# We need:
+# cpu
+
+###### Result #######
+print '
+ _____ ____ _____ _____
+ / ___ \ | _ \ / ____| __ \
+ / / / /___ ___ ____ | |_) | (___ | | | |
+ / / / / __ \/ _ \/ __ \| _ < \___ \| | | |
+ / /__/ / /_/ / __/ / / /| |_) |____) | |__| |
+ \_____/ .___/\___/_/ /_/ |____/|_____/|_____/
+ /_/
+ ';
+
+print "\n";
+print "\t Username: \t $username\n";
+print "\t OS: \t $os\n";
+print "\t Kernel: \t $kernel_out\n";
+print "\t Hostname: \t $hostname\n";
+print "\t Uptime: \t $uptime_cut $uptime[1]\n";
+print "\t Shell: \t $shell\n";
+print "\t Memory: \t Real: $mem[2] \/ Free: $mem[5]\n";
+print "\t Home FS: \t Used:$space_stripped[2] \/ Free: $space_stripped[3]\n\n";