Update startup script logging

This commit is contained in:
Andrew Scott 2023-06-17 00:03:57 -04:00
parent aee7ea1b5d
commit d1f95edd20
Signed by: a
GPG key ID: 7CD5A5977E4931C1
8 changed files with 89 additions and 39 deletions

View file

@ -1,14 +1,21 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE_BAR1="${XDG_STATE_HOME}"/polybar1.log
LOG_FILE_BAR2="${XDG_STATE_HOME}"/polybar2.log
echo "--- ${START_TIME} ---" > "$LOG_FILE_BAR1"
echo "--- ${START_TIME} ---" > "$LOG_FILE_BAR2"
# Terminate already running bar instances
killall -q polybar
#killall -q polybar # needed if ipc disabled
polybar-msg cmd quit
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.config/polybar/config
echo "---" | tee -a /tmp/polybar1.log /tmp/polybar2.log
polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a /tmp/polybar1.log & disown
polybar two -r --config=~/.config/polybar/config.ini 2>&1 | tee -a /tmp/polybar2.log & disown
# Launch Polybar
polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a "$LOG_FILE_BAR1" & disown
polybar two -r --config=~/.config/polybar/config.ini 2>&1 | tee -a "$LOG_FILE_BAR2" & disown
echo "Polybar launched..."

View file

@ -1,5 +1,14 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE_WIRE="${XDG_STATE_HOME}"/wireplumber.log
LOG_FILE_PIPE="${XDG_STATE_HOME}"/pipewire.log
LOG_FILE_PULSE="${XDG_STATE_HOME}"/pipewire-pulse.log
echo "--- ${START_TIME} ---" > "$LOG_FILE_WIRE"
echo "--- ${START_TIME} ---" > "$LOG_FILE_PIPE"
echo "--- ${START_TIME} ---" > "$LOG_FILE_PULSE"
# Kill any running pipewire processes
killall -q wireplumber & killall -q pipewire-pulse & killall -q pipewire
@ -12,8 +21,7 @@ while pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done
until pgrep -u $UID -f /usr/lib/xdg-desktop-portal >/dev/null; do sleep 1; done
# Launch pipewire
echo "---" | tee -a /tmp/{wireplumber.log,pipewire.log,pipewire-pulse.log}
/usr/bin/wireplumber 2>&1 | tee -a /tmp/wireplumber.log & disown
/usr/bin/pipewire 2>&1 | tee -a /tmp/pipewire.log & disown
/usr/bin/pipewire-pulse 2>&1 | tee -a /tmp/pipewire-pulse.log & disown
/usr/bin/wireplumber 2>&1 | tee -a "$LOG_FILE_WIRE" & disown
/usr/bin/pipewire 2>&1 | tee -a "$LOG_FILE_PIPE" & disown
/usr/bin/pipewire-pulse 2>&1 | tee -a "$LOG_FILE_PULSE" & disown

View file

@ -1,5 +1,10 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE="${XDG_STATE_HOME}"/polybar.log
echo "--- ${START_TIME} ---" > "$LOG_FILE"
# Terminate already running bar instances
#killall -q polybar # needed if ipc disabled
polybar-msg cmd quit
@ -8,7 +13,5 @@ polybar-msg cmd quit
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar
echo "---" | tee -a /tmp/polybar.log
polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a /tmp/polybar.log & disown
polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a "$LOG_FILE" & disown
echo "Polybar launched..."

View file

@ -1,17 +1,29 @@
#!/bin/bash
# dim screen after 2 minutes, turn screen off after 10, suspend after an hour
echo "---" | tee -a /tmp/swayidle-dim.log
swayidle -w \
timeout 120 "light -O && light -S .1" \
resume "light -I" \
2>&1 | tee -a /tmp/swayidle-dim.log & disown
START_TIME=`date +"%b %d, %Y %T"`
#LOG_FILE_DIM="${XDG_STATE_HOME}"/swayidle-dim.log
LOG_FILE_LOCK="${XDG_STATE_HOME}"/swayidle.log
echo "---" | tee -a /tmp/swayidle.log
swayidle -w \
timeout 600 "wlr-randr --output eDP-1 --off" \
timeout 3600 "loginctl suspend" \
resume "wlr-randr --output eDP-1 --on" \
before-sleep "if ![[ pgrep -x waylock ]]; then waylock -fork-on-lock -init-color 0x000000; fi" \
2>&1 | tee -a /tmp/swayidle.log & disown
#echo "--- ${START_TIME} ---" > "$LOG_FILE_DIM"
echo "--- ${START_TIME} ---" > "$LOG_FILE_LOCK"
# kill running processes
killall -q swayidle
# dim screen after 2 minutes, lock after 5, turn off after 15, suspend after 60
#swayidle -w \
# timeout 120 'light -O && light -S .1' \
# resume 'light -I' \
# 2>&1 | tee -a "$LOG_FILE_DIM" & disown
swayidle -w \
timeout 120 'light -O && light -S .1' \
resume 'light -I' \
timeout 300 'waylock-launcher' \
resume 'light -I' \
timeout 900 'light -I && wlr-randr --output eDP-1 --off' \
resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \
timeout 3600 'loginctl suspend' \
resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \
2>&1 | "$LOG_FILE_LOCK" & disown

View file

@ -1,5 +1,10 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE="${XDG_STATE_HOME}"/tint2.log
echo "--- ${START_TIME} ---" > "$LOG_FILE"
# Terminate already running bar instances
killall -q tint2
@ -7,8 +12,7 @@ killall -q tint2
while pgrep -u $UID -x tint2 >/dev/null; do sleep 1; done
# Launch tint2
echo "---" | tee -a /tmp/tint2.log
tint2 2>&1 | tee -a /tmp/tint2.log & disown
tint2 2>&1 | tee -a "$LOG_FILE" & disown
# Final command won't work without sleep
sleep 1 &&

View file

@ -1,5 +1,10 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE="${XDG_STATE_HOME}"/waybar.log
echo "--- ${START_TIME} ---" > "$LOG_FILE"
# Terminate already running bar instances
killall -q waybar
@ -10,6 +15,5 @@ while pgrep -u $UID -x waybar >/dev/null; do sleep 1; done
until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done
# Launch Waybar
echo "---" | tee -a /tmp/waybar.log
waybar 2>&1 | tee -a /tmp/waybar.log & disown
waybar 2>&1 | tee -a "$LOG_FILE" & disown

View file

@ -1,10 +1,16 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE="${XDG_STATE_HOME}"/xidlehook.log
echo "--- ${START_TIME} ---" > "$LOG_FILE"
# Wait on pipewire or "--not-when-audio" will break everything
until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done
# lock screen after 10 minutes
echo "---" | tee -a /tmp/xidlehook.log
xidlehook --not-when-audio --not-when-fullscreen \
--timer 600 "xset s activate" "" \
2>&1 | tee -a /tmp/xidlehook.log & disown
xidlehook \
--not-when-audio \
--not-when-fullscreen \
--timer 600 'xset s activate' '' \
2>&1 | tee -a "$LOG_FILE" & disown

View file

@ -1,12 +1,18 @@
#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
LOG_FILE="${XDG_STATE_HOME}"/xidlehook.log
echo "--- ${START_TIME} ---" > "$LOG_FILE"
# Wait on pipewire or "--not-when-audio" will break everything
until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done
# dim screen after 2 minutes, lock screen after 10, suspend after an hour
echo "---" | tee -a /tmp/xidlehook.log
xidlehook --not-when-audio --not-when-fullscreen \
--timer 120 "killall -q redshift && xrandr --output eDP-1 --brightness .1" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \
--timer 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \
--timer 3000 "loginctl suspend" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \
2>&1 | tee -a /tmp/xidlehook.log & disown
xidlehook \
--not-when-audio \
--not-when-fullscreen \
--timer 120 'killall -q redshift && xrandr --output eDP-1 --brightness .1' 'xrandr --output eDP-1 --brightness 1 && redshift -r & disown' \
--timer 480 'xset s activate' 'xrandr --output eDP-1 --brightness 1 && redshift -r & disown' \
--timer 3000 'loginctl suspend' 'xrandr --output eDP-1 --brightness 1 && redshift -r & disown' \
2>&1 | tee -a "$LOG_FILE" & disown