#!/bin/sh # do not use names starting with [0-9][0-9] for data files FLAG_DIR="${UACTIVITY_CACHEDIRECTORY}/key/$(basename ${0}).data" FLAG_FILE="${FLAG_DIR}/flag" case "${UACTIVITY_ORGIN}" in startup) # create flag directory (using cache directory) mkdir -p "${FLAG_DIR}" # delete flag (may leftover from previus vdr crash) # kepp the flag if toggle state should be keep over vdr sessions rm -f "${FLAG_FILE}" ;; running) # we are interested in Key "1" if [ "${UACTIVITY_INFO_KEY}" = "1" ]; then if [ -f "${FLAG_FILE}" ]; then # here we do our "off" action logger -t "uactivity [key/$(basename ${0})]" "$(basename ${0}) off" rm -f "${FLAG_FILE}" else # here we do our "on" action logger -t "uactivity [key/$(basename ${0})]" "$(basename ${0}) on" touch "${FLAG_FILE}" fi fi ;; esac exit 0