[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Konversation] 268eac8: Added uptime script by Magnus Romnes
From:       Dario Abatianni <eisfuchs () tigress ! com>
Date:       2010-07-01 13:27:09
Message-ID: 20100701132709.4F8EEBB5520 () projects ! kde ! org
[Download RAW message or body]


	A	 scripts/uptime	 [License: UNKNOWN]

commit 268eac81bfcf32cb7254ef126cb17378fe09fd09
Author: Dario Abatianni <eisfuchs@tigress.com>
Date:   Fri Dec 5 20:53:18 2003 +0000

    Added uptime script by Magnus Romnes
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=271411

diff --git a/scripts/README b/scripts/README
index 39ec15b..4075481 100644
--- a/scripts/README
+++ b/scripts/README
@@ -25,3 +25,6 @@ gauge		Displays funny "beer load" meter. Author: Eisfuchs, Idea: \
berkus.  noatun		Displays on the current channel what you are playing
 		in noatun right now.
 		usage: /exec noatun
+
+uptime          Displays the system uptime on the current channel.
+                usage: /exec uptime
diff --git a/scripts/uptime b/scripts/uptime
new file mode 100755
index 0000000..3883e6d
--- /dev/null
+++ b/scripts/uptime
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+# Uptime script for Konversation
+# made by Magnus Romnes (gromnes@online.no)
+# The script might be uncompatible with other unix variants than linux.
+# only tested on Debian GNU/Linux Sid
+# use the code for whatever you wish :-)
+
+
+$PORT = shift;
+$SERVER = shift;
+$TARGET = shift;
+$UPTIME = `cat /proc/uptime2`;
+if($UPTIME)
+	{
+	@uparray = split(/\./, $UPTIME);
+	$seconds = $uparray[0];
+	if($seconds >= 86400)
+		{
+		$days = int($seconds/86400);
+		$seconds = $seconds-($days*86400);
+		}
+	if($seconds >= 3600)
+		{
+		$hours = int($seconds/3600);
+		$seconds = $seconds-($hours*3600);
+		}
+	if($seconds > 60)
+		{
+		$minutes = int($seconds/60);
+		}
+	exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"Uptime: $days days, $hours \
hours and $minutes minutes\""); +	}
+else
+	{
+	exec ("dcop $PORT Konversation info \"Could not read uptime. Check that \
/proc/uptime exists.\""); +	}
+


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic