Friday, 26 July 2013

Moved to my own wordpress installation

This blog has now been moved with all history to my own Wordpress installation, at

This way I can include more plugins, for example for formatting source code.

Friday, 12 July 2013

Notify all users logged in over X2Go on their graphical desktop

I am providing now a server for development of OpenPetra, with X2Go desktop remoting.
See more details at

To save costs, I am running the server on a jiffybox, which costs less when you freeze it.

So I am providing a php script that allows starting the machine, and to refresh it. After the last start or refresh, the machine will be stopped and frozen.

Now it would be good to remind the users once in an hour to do visit the refresh link.
I am using zenity to display the message.
This script will get all users logged in over X2Go, and display the message on their desktops:

message="Server will shutdown soon, please refresh if you still need it by visiting"
for display in `ps xaf | grep x2goagent | grep -v grep | awk '{ print ( $(NF) ) }'`
  user=`ps xaf | grep x2goagent | grep -v grep | grep "$display$" | awk ' { print ( $(NF-5) ) }' | awk ' { print ( $3 ) }' FS='/'`
  echo "$user $display"
  su - $user -c "zenity --info --display=$display --text='$message'&"

(for better layout, see

The crontab looks like this, to run it every hour:
0 */1 * * * /root/

The php script looks like this:

The script is installed on a separate machine, that is always running.
The users can call jiffybox.php/?operation=refresh to start or refresh the machine.
The cronjob for stopping the machine looks like this:
*/15 * * * * cd ~/subs/jb; php jiffybox.php