small bugfixes
This commit is contained in:
parent
714a15f664
commit
3cb3440d80
|
@ -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 $*"
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue