Notify system startup errors
parent
028fa5e180
commit
b59e66226c
|
@ -31,6 +31,11 @@ if ostype == "Linux" then
|
||||||
vicious = require("vicious")
|
vicious = require("vicious")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Custom variables.
|
||||||
|
local termcmd = os.getenv("TERMCMD") or "urxvt"
|
||||||
|
local term = termcmd .. " -e "
|
||||||
|
local home = os.getenv("HOME")
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Error handling
|
-- Error handling
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -58,6 +63,19 @@ do
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Notify system startup errors.
|
||||||
|
do
|
||||||
|
for _, file in pairs({home .. "/errors-dmesg.log", home .. "/errors-systemd.log"}) do
|
||||||
|
local f = io.open (file,'r')
|
||||||
|
if f ~= nil then
|
||||||
|
f:close ()
|
||||||
|
naughty.notify({ preset = naughty.config.presets.critical,
|
||||||
|
title = "System startup error!",
|
||||||
|
text = "See " .. file })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Themes define colours, icons, and wallpapers
|
-- Themes define colours, icons, and wallpapers
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -231,9 +249,6 @@ move_mouse_away()
|
||||||
-- Note that some laptop will not work when pressing Super+Fn.
|
-- Note that some laptop will not work when pressing Super+Fn.
|
||||||
-- Therefore we only use Fn and Mod1+Fn.
|
-- Therefore we only use Fn and Mod1+Fn.
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
termcmd = os.getenv("TERMCMD") or "urxvt"
|
|
||||||
term = termcmd .. " -e "
|
|
||||||
home = os.getenv("HOME")
|
|
||||||
|
|
||||||
globalkeys = awful.util.table.join(
|
globalkeys = awful.util.table.join(
|
||||||
-- Terminal
|
-- Terminal
|
||||||
|
|
14
.profile
14
.profile
|
@ -123,6 +123,20 @@ if [ -d "$HOME/.go" ]; then
|
||||||
appendpath "$GOPATH/bin"
|
appendpath "$GOPATH/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Startup error log.
|
||||||
|
## dmesg
|
||||||
|
log_dmesg="$(dmesg | grep -i error)"
|
||||||
|
[ -n "$log_dmesg" ] && echo "$log_dmesg" > "$HOME/errors-dmesg.log" || rm -f "$HOME/errors-dmesg.log"
|
||||||
|
## systemd
|
||||||
|
if command -v systemctl >/dev/null 2>&1; then
|
||||||
|
count="$(systemctl -l --failed | awk '{print $1;exit}')"
|
||||||
|
if [ $count -ne 0 ]; then
|
||||||
|
systemctl -l --failed > "$HOME/errors-systemd.log"
|
||||||
|
else
|
||||||
|
rm -f "$HOME/errors-systemd.log"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
## Hook. Should be sourced last
|
## Hook. Should be sourced last
|
||||||
[ -f ~/.profile_hook ] && . ~/.profile_hook
|
[ -f ~/.profile_hook ] && . ~/.profile_hook
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in New Issue