Ejecutar Hotot desde el escritorio

Tras la instalación de hotot ( Cómo instalar hotot en opensuse 11.3), cree un acceso directo en el escritorio apuntando a donde estaba el ejecutable, en mi caso:
/home/dieguz2/Programas/hotot/hotot.py

Pero me daba los siguientes errores:
Traceback (most recent call last):
File "./hotot.py", line 302, in
main()
File "./hotot.py", line 285, in main
agent.init_notify()
File "/home/dieguz2/Programas/hotot/hotot/agent.py", line 87, in init_notify
utils.get_ui_object('imgs/ic64_hotot.png')))
TypeError: pixbuf_new_from_file() argument 1 must be string, not None

Aparentemente sólo podía ejecutar hotot desde el directorio:
/home/dieguz2/Programas/hotot/

y llamando a
./hotot/hotot.py

Si nos e hacia así no encontraba varios de sus recursos.

Para poder ejecutarlo desde cualquier sitio haremos lo siguiente
1) Creamos un archivo en el directorio de hotot. En mi caso el directorio es /home/dieguz2/Programas/hotot/. Le damos permisos de ejecución
touch /home/dieguz2/Programas/hotot/runfromhere.py
chmod u+x /home/dieguz2/Programas/hotot/runfromhere.py

2) Editamos dicho archivo (cat > /home/dieguz2/Programas/hotot/runfromhere.py) y le añadimos el siguiente contenido:
#!/usr/bin/env python
# Copyright (C) 2010 dieguz2
# License: GNU GPL v3
# http://dieguz2.blogspot.com/
# script: runfromhere.py
# description: change current working directory to the path where the script is and then execute COMMAND
import os
import sys

command="./hotot/hotot.py" # command we want to execute
dirname= os.path.dirname(os.path.abspath(sys.argv[0])) # get path where this script is
os.chdir(dirname)
os.system(command)
En este script obtenemos el path absoluto donde está el script ( no es el mismo que el path de llamada). Como dicho script está alojado en el home de hotot, cambiamos a dicho directorio y ejecutamos hotot desde ahí

3) Para ejecutar hotot desde el escritorio o desde cualquier sitio, ejecutaremos el archivo que hemos creado.
/home/dieguz2/Programas/hotot/runfromhere.py



Otra forma alternativa es crear un shell script (o en python) como el siguiente y colocarlo por ejemplo en nuestro ~/bin de usuario. En este caso pondremos en la variable hotot_path la ruta donde está instalado hotot:
touch ~/bin/hotot.sh
chmod u+x ~/bin/hotot.sh
cat > ~/bin/hotot.sh
#!/bin/sh
hotot_path=/home/dieguz2/Programas/hotot
cd $hotot_path
./hotot/hotot.py

SLES 11 : habilitar / desabilitar ipv6

Con los siguientes pasos desabilitaremos o hablitaremos el soporte para IPv6 en Suse Linux Enterprise Server y en Opensuse 11.3

Para habilitar o deshabilitar:
1) Como super usuario ejecutamos el comando yast
2) Vamos a "Network Devices / Network Setting". En español se denomina "Dispositivos de Red / Ajustes de red"
3) En "Opciones Globales" marcamos o desmarcamos " Habilitar IPv6"

Será necesario reiniciar el server

Instalar el cliente de twitter Hotot en opensuse 11.3

Vamos a instalar el cliente de twitter Hotot. La instalación la realizaremos a partir del código fuente, usando mercurial para obtener una copia del repositorio. Este cliente esta basado en python por lo que las librerías están relacionadas con el mismo.

1) Instalar paquetes necesarios :
sudo zypper in python-webkitgtk python-notify mercurial python-distutils-extra git gnome-common mercurial

2) Instalar paquete python-keybinder requerido por el programa y que no se encuentra en los repositorios de opensuse.Vamos a clonar el repositorio, hacer un make, instalarlo y luego refrescaremos las librerías:
git clone http://github.com/engla/keybinder.git
cd keybinder/
./autogen.sh
./configure --prefix=/usr
make
sudo make install
sudo /sbin/ldconfig

PD: Nos indica Hawk (gracias por el aporte) que el paquete se puede encontrar en el repositorio de XFCE de opensuse. Podemos agregarlo a través de "repositorios de Software" en Yast en los repositorio de la comunidad. Para añadirlo a través de línea de comandos:
sudo zypper ar http://download.opensuse.org/repositories/X11:/xfce/openSUSE_11.3/ XFCE
sudo zypper in python-keybinder

3) Ahora vamos a instalar el cliente propiamente dicho. Crearemos un clon del repositorio con mercurial y ejecutaremos el cliente:
hg clone https://hotot.googlecode.com/hg/ hotot
cd hotot/
./hotot/hotot.py


En vez de ejecutarlo podríamos instalarlo (./install), pero no está recomendado por los creadores de hotot

Bash : script para comprobar la conexión con un servidor usando sonido

El siguiente código escrito en bash comprueba la conexión con un servidor. Si dicho servidor está vivo ( is alive!! ) no realiza ninguna salida. Si el servidor no responde a los pings (está caido) hará que suene un archivo de sonido (alarma).

Es útil para dejarlo en segundo plano y avisarnos si una maquina se ha caido. O bien para comprobar periódicamente si estamos conectados a internet (por ejemplo poniendo un host como www.google.es) de modo que si perdemos nuestra conexión local sonará la alarma.

Tiene dos tiempos configurables que indican que tiempo hay que esperar entre comprobación y comprobación.

#/bin/bash
#
# Copyright (C) 2010 dieguz2
# License: GNU GPL v3
# http://dieguz2.blogspot.com/
# Contributors: flipa_illo
# This script check if the hostname passed as argument responds ping probes. If host is down then plays a wav file.
# name: isalive.sh
# Usage: isalive.sh hostname
# Usage example: ./isalive.sh www.google.es

#Variables
sleeptime_all_ok=60 # time between ping probes when target host is alive
sleeptime_hostdown=180 # time between ping probes when target host is down

wavefile=/home/dieguz/Música/beep.wav

while true; do
comando=`ping -c 1 $1 2> /dev/null`
nofunciona=$?
#0 host exists and is alive
#1 host exists and is not alive
#2 host doesnt exists
if [ $nofunciona -eq 1 ] ; then
/usr/bin/playwave $wavefile &> /dev/null
sleeptime=$sleeptime_hostdown
else
if [ $nofunciona -eq 2 ] ; then
echo "unknown host"
exit 2;
else
sleeptime=$sleeptime_all_ok

fi

fi
sleep $sleeptime
done