diff --git a/misc/cronhelp b/misc/cronhelp index d381449..c70299f 100755 --- a/misc/cronhelp +++ b/misc/cronhelp @@ -3,12 +3,13 @@ source ${$(realpath "$0"):h:h}/lib/common.zsh import-env awesome +ALLARGS=("$@") zparseopts -D -maxidle:=maxidle -in-chronic=chronic l:=logfile -logfile:=logfile if [[ $logfile ]]; then function debug() { - echo "$(date --iso-8601=seconds) $*" >> $logfile + echo "$(date --iso-8601=seconds) $*" >> ${logfile[2]} } else function debug() {} @@ -16,13 +17,14 @@ fi if [[ ! $chronic ]]; then debug "Restarting with chronic" - exec chronic $0 --in-chronic $ALLARGS + exec chronic $0 --in-chronic "${ALLARGS[@]}" fi if [[ $maxidle ]]; then + idle=$(xprintidle) maxidle=${maxidle[2]} - debug "Checking idle time: $(xprintidle) / 1000 < $maxidle" - if (($(xprintidle) / 1000 < $maxidle)); then + debug "Checking idle time: $idle / 1000 < $maxidle" + if (($idle / 1000 < $maxidle)); then debug "Checking pgrep $1: $(pgrep $1)" if ! pgrep $1; then debug "Running $*" diff --git a/void/xcheckupdates b/void/xcheckupdates index 6016567..43ec67a 100755 --- a/void/xcheckupdates +++ b/void/xcheckupdates @@ -7,7 +7,7 @@ zparseopts -D -E l=list -list=list if [[ -e $IDCACHE ]]; then prev_id=$(<$IDCACHE) fi -xbps-install -S &>/dev/null +sudo xbps-install -S &>/dev/null updates=$(xbps-install -un 2>&1) num_updates=$(echo -n $updates | wc -l)