--------------------------------Linux Guide---------------------------------- by Ingo Blechschmidt (c) 2002 ----------------------------------------------------------------------------- ------------------------- Variierender Hintergrund ------------------------- Sam Jun 16 16:26:31 MEST 2001 ------------------------- Hintergrund xsetbg Variierender_Hintergrund Skript Cron-Job Job ----------------------------------------------------------------------------- Sie wollen nicht immer dasselbe Hintergrundbild haben - KDE bietet zwar eine Funktion zum zufälligen Wechseln der Hintergrundbildes, aber Sie benutzen Gnome, einen anderen Windowmanager, oder gar keinen. ----------------------------------------------------------------------------- Wieder einmal müssen verschiedene Linux-Programme zusammen arbeiten: In diesem Fall crond (Zeitdämon) und bash (Interpreter des Shellskripts). --------CODE--------: Das Shell-Skript /home/progs/sev_images.sh #!/bin/bash # sev_images.sh - Wechselt das Hintergrundbild des Root-Windows # (c) by Ingo Blechschmidt # Sam Jun 16 16:30:31 MEST 2001 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Ingo Blechschmidt # Arberstraße 5 # 86179 Augsburg # E-Mail: iblech@web.de, http://www.way.to/uselinux/ # Tel.: +49 / 821 882955 # # if [ ! -e /tmp/.X0-lock ]; then exit 1; fi aa=$1 e=`ls -1 $1 | wc -l` d=$[$RANDOM%$e] b() { c=$1 for ie in `seq $c`; do shift done /usr/X11R6/bin/convert $aa$1 $HOME/bgroot.xpm > /dev/null && { /usr/X11R6/bin/xsetbg -onroot -smooth $HOME/bgroot.xpm -display :0.0 2> /dev/null rm $HOME/bgroot.xpm 2> /dev/null } } b $d `ls -1 $aa` & exit 0 #; --------/CODE-------- --------CODE--------: Der notwendige Crontab-Eintrag */4 * * * * /usr/local/bin/sev_images /opt/kde/share/wallpapers/ --------/CODE-------- Zusätzlich ist ein symbolischer Link von /home/progs/sev_images.sh nach /usr/local/bin/sev_images zu setzen (ln -s /home/progs/sev_images.sh /usr/local/bin/sev_images ). Das kde in der Zeile muss, wenn Sie kde2 benutzen, durch kde2 ersetzt werden. Die Crontab kann mittels crontab -e verändert werden. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- This document is distributed under the terms of the GNU Free Documentation License.