Archiv für August, 2007
  |  
Markus am 29.08.07 um 8:36 pm Uhr

The Essential Motörhead

Music's my life

Da musste ich einfach zuschlagen: The Essential Motörhead

The Essential Motorhead

Einfach traumhaft laut. Wow. Die nächsten Autofahrten sind gerettet - keine Langeweile mehr. Endlich wieder ohne Bayern3.

Achja, auf dem Cover steht folgende wichtige Information:

… but be advised that it’s definitely not for the faint-heartet. After all, this is the band who said, “If we moved in next door to you, your lawn would die.”

Somit hätten wir schonmal geklärt, dass die CD mir gut paßt: faint-heartet - no way…

Obwohl mich schonmal interessieren würde, was so alles bei meinen Nachbarn abstirbt. Doch halt mal - das will ich lieber nicht wissen.

Markus am 19.08.07 um 7:32 pm Uhr

Fortune in Wordpress (ständig wechselndes Zitat)

Wordpress

Meine bash hat das - wie ich finde - sehr angenehme Verhalten bekommen, mir bei jedem Einloggen ein Zitat anzubieten. Das funktioniert mit Hilfe des Fortune-Programmes.

Damit die Bash bei jedem Login einen derartigen Spruch anzeigt, sollte man einen entsprechenden Aufruf in das Config-File .bashrc einbinden. Das sieht bei mir dann so aus:

#This adds some fun to the starting of the bash
if [ -x /usr/games/fortune ]; then
/usr/games/fortune -s
fi


An dieser Stelle hatte ich mir gedacht: OK, jetzt müßte Wordpress das halt auch noch können - auf einer Seite ein Zufallszitat anzuzeigen. Da ich ja gestern mich schon mit dem durchschieben von Systembefehlen mittels php beschäftigt habe, sollte das natürlich kein Problem darstellen. Das Ergebnis kann man im Augenblick in der Sitebar “bewundern”. Den Quellcode dazu gibt es natürlich auch:

<?php passthru("/usr/games/fortune /usr/share/games/fortunes/literature"); ?>

Live und in Farbe sieht das dann so aus:

We were young and our happiness dazzled us with its strength. But there was
also a terrible betrayal that lay within me like a Merle Haggard song at a
French restaurant. [...]
I could not tell the girl about the woman of the tollway, of her milk
white BMW and her Jordache smile. There had been a fight. I had punched her
boyfriend, who fought the mechanical bulls. Everyone told him, “You ride the
bull, senor. You do not fight it.” But he was lean and tough like a bad
rib-eye and he fought the bull. And then he fought me. And when we finished
there were no winners, just men doing what men must do. [...]
“Stop the car,” the girl said.
There was a look of terrible sadness in her eyes. She knew about the
woman of the tollway. I knew not how. I started to speak, but she raised an
arm and spoke with a quiet and peace I will never forget.
“I do not ask for whom’s the tollway belle,” she said, “the tollway
belle’s for thee.”
The next morning our youth was a memory, and our happiness was a lie.
Life is like a bad margarita with good tequila, I thought as I poured whiskey
onto my granola and faced a new day.
– Peter Applebome, International Imitation Hemingway
Competition

Markus am 18.08.07 um 12:28 pm Uhr

Php code in Wordpress-Seite

Wordpress

Gestern habe ich mich nun dazu durchgerungen, ein neues Wordpress - Theme zu installieren. Irgendwann habe ich mich dann für dieses entschieden. Es ist deutlich klarer, als das alte.

Aber, wie das Leben so spielt, man kommt vom Hundertsten ins Tausendste. Und da bin ich gleich bei der Stelle angekommen, an der ich schonmal keine Lust hatte weiterzumachen: php-Code in einer Wordpress-Seite unterzubringen. Und zwar wollte ich gern einige Informationen über die Hardware, auf der der Apache läuft im Wordpress anzeigen lassen. Dazu hatte ich ein Bash-Script geschrieben, welches diese Informationen ausliest und als Text bereitstellt. Dann bietet php zwei hübsche Befehle an, um derartige Scripte aufzurufen:

passthru

und

exec()

PHP-Befehle in “normale” html-Seiten einzubinden ist auch nicht weiter tragisch.

<?php echo "Das ist die Ausgabe von php" ?>

Nur macht die Wörterpresse daraus alles mögliche nur kein embedded php. Dazu gibt es aber das geniale Plugin exec-php. Damit das funktioniert muss man noch den Rich-Text-Editor der Wörterpresse disablen. (War gar nicht so einfach zu finden, wie das geht:
Admin-Menue–>Users–>Your Profile–>Personal Options–>Häkchen vor “Use the visual rich editor when writing” entfernen).
Und schon funktioniert auch der oben dargestellte Code…

Das ist die Ausgabe von php

Die Ausgabe eines Bash-Scriptes auf einer Wordpress page kann durch die Implementierung dieses Befehls erreicht werden:

<?php exec("/pfad/zum/script.sh") ?>

Life kann man das ganze auf dieser Seite begutachten. Und das zugehörige Script sieht folgendermassen aus:

#!/bin/bash

echo “< b>Some information about the cpu
cat /proc/cpuinfo | while read; do echo $REPLY ““; done
echo ” ”
echo “< b>Some Information about the devices
lspci | while read; do echo $REPLY ““; done
echo “
echo “< b>The uptime of the machine:
echo $(uptime)
echo ” ”
echo “< b>Currently logged in users:
who | while read; do echo $REPLY ““;done
echo ” ”
echo “< i>OK, it is not the fastest, but it’s quiet and it does not consume a lo\t of power (aproximately 40 Watts). So it’s the right one for doing stuff like that.
echo ” ”

Markus am 14.08.07 um 12:00 pm Uhr

Uptime auf Windows Maschine auslesen

Windows

Da wollte ich doch dienstlich mal die uptime des Windows XP-Rechners auslesen. Den komfortablen Befehl “uptime” gibt es da allerdings nicht. Also etwas gegoogled und den hier gefunden:

systeminfo

Der zeigt neben der Uptime außerdem noch Informationen zur installierten Hardware und den Hotfixes. Praktisch ist es außerdem, dass ich diese Informationen von jedem beliebigen Rechner holen kann:

systeminfo /S hostnamexyz

Auf diesem Wege werden die o.g. Daten des Rechners hostnamexyz geholt und angezeigt.

Update:

Bei Microsoft kann eine kleine Anwendung downgeloaded werden, die ähnliche Wünsche erfüllt, wie uptime auf Unix-Maschinen. Die Anwendung ist nach C:\Winnt zu kopieren. Anschließend einfach mit uptime aufrufen.
Interessant ist dieser Call: uptime /s . Dabei wird ein Log-File ausgegeben, wann die Maschine gebootet wurde. Weiterhin wird eine Statistik ausgegeben. Bei mir beispielsweise so:

.
.
.
11.09.2007 06:06:23 Boot Prior downtime:0d 14h:51m:31s
11.09.2007 16:27:04 Shutdown Prior uptime:0d 10h:20m:41s
12.09.2007 06:07:47 Boot Prior downtime:0d 13h:40m:43s
12.09.2007 16:42:18 Shutdown Prior uptime:0d 10h:34m:31s
13.09.2007 06:06:22 Boot Prior downtime:0d 13h:24m:4s
13.09.2007 15:18:03 Shutdown Prior uptime:0d 9h:11m:41s
14.09.2007 06:05:49 Boot Prior downtime:0d 14h:47m:46s
14.09.2007 14:43:03 Shutdown Prior uptime:0d 8h:37m:14s
17.09.2007 06:05:56 Boot Prior downtime:2d 15h:22m:53s
17.09.2007 14:42:34 Shutdown Prior uptime:0d 8h:36m:38s
18.09.2007 06:09:40 Boot Prior downtime:0d 15h:27m:6s

Current System Uptime: 0 day(s), 0 hour(s), 19 minute(s), 45 second(s)

——————————————————————————–

Since 23.11.2006:

Total Reboots: 348
Mean Time Between Reboots: 0.86 days
Total Bluescreens: 0

——————————————————————————–

Since 29.05.2007:

System Availability: 22.4243%
Total Uptime: 25d 0h:41m:5s
Total Downtime: 86d 14h:1m:55s
Total Reboots: 103
Mean Time Between Reboots: 1.08 days
Total Bluescreens: 0 *lach*

Notes:
29.05.2007 is the earliest date in the event log where
sufficient information is recorded to calculate availability.

Alles in allem eine hilfreiche Möglichkeit um die Uptime auf Windows-Maschinen auszuwerten.

  |