Creashlog: handle default values.

This commit is contained in:
Kenneth Johansson 2015-09-21 16:01:46 +02:00
parent adaacf2a8f
commit be38a7233b
3 changed files with 49 additions and 5 deletions

View file

@ -23,6 +23,15 @@ send_log()
done
}
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=crashlog
/sbin/uci set system.crashlog.enable=no
/sbin/uci set system.crashlog.server="crash.inteno.se"
/sbin/uci commit
}
boot()
{
# is crashlog enabled ?
@ -31,6 +40,10 @@ boot()
0|no|NO|false|FALSE)
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
# is this boot a result from a crash ?

View file

@ -15,15 +15,27 @@ alive()
fi
}
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=corelog
/sbin/uci set system.corelog.enable=no
/sbin/uci set system.corelog.server="crash.inteno.se"
/sbin/uci commit
}
# is corelog enabled ?
enable=$(/sbin/uci get system.corelog.enable)
case $enable in
0|no|NO|false|FALSE|"")
0|no|NO|false|FALSE)
# drain core file from kernel
cat >/dev/null
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
server=$(/sbin/uci get system.corelog.server)

View file

@ -7,11 +7,30 @@ USE_PROCD=1
NAME=iwatchdog
PROG=/sbin/iwatchdog
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=watchdog
/sbin/uci set system.watchdog.enable=no
/sbin/uci commit
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
enable=$(/sbin/uci get system.watchdog.enable)
case $enable in
0|no|NO|false|FALSE)
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
#stop() {