Debian Codegraph @

fvwm/scripts/DesktopCheckMounts

raw
1 #!/bin/bash
2 # FVWM-Crystal helper script that check for mount changes
3 # Usage: Exec exec $[FVWM_SYSTEMDIR]/scripts/DesktopCheckMounts <delay [s]>
4
5 # the PID to kill if fvwm is interrupted
6 TMPFILE="/tmp/crystal_desktopcheckmount_$$"
7 touch ${TMPFILE}
8
9 cleanup() {
10 rm ${TMPFILE}
11 exit 0
12 }
13
14 trap cleanup INT QUIT TERM
15
16 # the main loop
17 CRC=$(cksum /proc/mounts|cut -d" " -f1)
18 while :
19 do
20 sleep "$1"
21 # fvwm is started by exec; be sure it is running
22 pidof fvwm 1>/dev/null || cleanup
23
24 NEWCRC=$(cksum /proc/mounts|cut -d" " -f1)
25 if [[ "$NEWCRC" != "$CRC" ]]; then
26 CRC="${NEWCRC}"
27 FvwmCommand LoadDesktopIcons
28 fi
29 done