On Fri, 2013-10-18 at 18:34 +0200, Ralf Mardorf wrote: > if [ "$(pidof wallpaperRandomSwitch.sh)" ] ; then > killall -9 -w wallpaperRandomSwitch.sh > fi > # add your code here > exit > > while pidof wallpaperRandomSwitch.sh > /dev/null ; killall wallpaperRandomSwitch.sh ; done > # add your code here > exit Or write an init script or systemd script, what ever you're using, to kill the script at shut down.