small bugfixes
This commit is contained in:
parent
714a15f664
commit
3cb3440d80
|
@ -3,12 +3,13 @@
|
||||||
|
|
||||||
source ${$(realpath "$0"):h:h}/lib/common.zsh
|
source ${$(realpath "$0"):h:h}/lib/common.zsh
|
||||||
import-env awesome
|
import-env awesome
|
||||||
|
ALLARGS=("$@")
|
||||||
|
|
||||||
zparseopts -D -maxidle:=maxidle -in-chronic=chronic l:=logfile -logfile:=logfile
|
zparseopts -D -maxidle:=maxidle -in-chronic=chronic l:=logfile -logfile:=logfile
|
||||||
|
|
||||||
if [[ $logfile ]]; then
|
if [[ $logfile ]]; then
|
||||||
function debug() {
|
function debug() {
|
||||||
echo "$(date --iso-8601=seconds) $*" >> $logfile
|
echo "$(date --iso-8601=seconds) $*" >> ${logfile[2]}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
function debug() {}
|
function debug() {}
|
||||||
|
@ -16,13 +17,14 @@ fi
|
||||||
|
|
||||||
if [[ ! $chronic ]]; then
|
if [[ ! $chronic ]]; then
|
||||||
debug "Restarting with chronic"
|
debug "Restarting with chronic"
|
||||||
exec chronic $0 --in-chronic $ALLARGS
|
exec chronic $0 --in-chronic "${ALLARGS[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $maxidle ]]; then
|
if [[ $maxidle ]]; then
|
||||||
|
idle=$(xprintidle)
|
||||||
maxidle=${maxidle[2]}
|
maxidle=${maxidle[2]}
|
||||||
debug "Checking idle time: $(xprintidle) / 1000 < $maxidle"
|
debug "Checking idle time: $idle / 1000 < $maxidle"
|
||||||
if (($(xprintidle) / 1000 < $maxidle)); then
|
if (($idle / 1000 < $maxidle)); then
|
||||||
debug "Checking pgrep $1: $(pgrep $1)"
|
debug "Checking pgrep $1: $(pgrep $1)"
|
||||||
if ! pgrep $1; then
|
if ! pgrep $1; then
|
||||||
debug "Running $*"
|
debug "Running $*"
|
||||||
|
|
|
@ -7,7 +7,7 @@ zparseopts -D -E l=list -list=list
|
||||||
if [[ -e $IDCACHE ]]; then
|
if [[ -e $IDCACHE ]]; then
|
||||||
prev_id=$(<$IDCACHE)
|
prev_id=$(<$IDCACHE)
|
||||||
fi
|
fi
|
||||||
xbps-install -S &>/dev/null
|
sudo xbps-install -S &>/dev/null
|
||||||
updates=$(xbps-install -un 2>&1)
|
updates=$(xbps-install -un 2>&1)
|
||||||
num_updates=$(echo -n $updates | wc -l)
|
num_updates=$(echo -n $updates | wc -l)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue