diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-11-09 16:49:57 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-11-09 16:49:57 +0100 |
commit | a4cfb3c53d7c5dbd7904ccacb1c3f65773ef0c6f (patch) | |
tree | 70526941e6cccae13923f01a43b092b3fc20bffa /widgets/system_information | |
parent | 521a6dc17ed9fc515e5f1bc8bfaf95ce04e83e8c (diff) | |
download | skin-flatplus-a4cfb3c53d7c5dbd7904ccacb1c3f65773ef0c6f.tar.gz skin-flatplus-a4cfb3c53d7c5dbd7904ccacb1c3f65773ef0c6f.tar.bz2 |
add main menu widgets
Diffstat (limited to 'widgets/system_information')
-rw-r--r-- | widgets/system_information/README | 12 | ||||
l--------- | widgets/system_information/system_information | 1 | ||||
-rwxr-xr-x | widgets/system_information/system_information.ubuntu | 134 |
3 files changed, 147 insertions, 0 deletions
diff --git a/widgets/system_information/README b/widgets/system_information/README new file mode 100644 index 00000000..946b5236 --- /dev/null +++ b/widgets/system_information/README @@ -0,0 +1,12 @@ +This widget provides several information about the current system state. + +The command "system_information" will be executed every time the widget is drawn, so please keep it short and fast. +The command "system_information" must provide several files with the infos. +The output files must begin with 01_ - 99_ for sort/position the info in the widget. For example "01_uptime", "02_load", etc.The values will be drawn in 2 columns except "system_version" and "kernel_version" they are drawn in a row. +For example: +System Version: Ubuntu 14.04.1 LTS +Load: 0.32 Uptime: 10:24:42 up 88 days + +You can include system_updatestatus and temperatures. But do not execute the system_updatestatus script (please read README of system_updatestatus) + +Please see the example!
\ No newline at end of file diff --git a/widgets/system_information/system_information b/widgets/system_information/system_information new file mode 120000 index 00000000..d61d4dfb --- /dev/null +++ b/widgets/system_information/system_information @@ -0,0 +1 @@ +system_information.ubuntu
\ No newline at end of file diff --git a/widgets/system_information/system_information.ubuntu b/widgets/system_information/system_information.ubuntu new file mode 100755 index 00000000..4222b602 --- /dev/null +++ b/widgets/system_information/system_information.ubuntu @@ -0,0 +1,134 @@ +#!/bin/bash + +# this script will be executed when the widget will be drawn +# so make it short and fast + +# enable/disable items +SHOW_SYS_VERSION=0 +SHOW_KERNEL_VERSION=0 +SHOW_UPTIME=1 +SHOW_LOAD=1 +SHOW_PROCESSES=1 +SHOW_MEM_USAGE=1 +SHOW_SWAP_USAGE=1 +SHOW_ROOT_USAGE=1 +SHOW_VIDEO_USAGE=1 +SHOW_VDR_CPU_USAGE=1 +SHOW_VDR_MEM_USAGE=1 + +SHOW_TEMPERATURES=0 +SHOW_SYSUPDATES=0 + +# Position of items +# sys_version & kernel_version are drawn in one line +# all others will be drawn in two column +# for example +# System Version: Ubuntu 14.04.1 LTS +# Uptime: 1:20 5m Load: 0.41 + +# must begin with 01 +SYS_VERSION_POS="01" +KERNEL_VERSION_POS="02" +UPTIME_POS="03" +LOAD_POS="04" +PROCESSES_POS="05" +MEM_USAGE_POS="06" +SWAP_USAGE_POS="07" +ROOT_USAGE_POS="08" +VIDEO_USAGE_POS="09" +VDR_CPU_USAGE_POS="10" +VDR_MEM_USAGE_POS="11" + +TEMP_CPU_POS=15 +TEMP_PCCASE_POS=16 +TEMP_GPU_POS=17 + +SYSUPD_POS=20 +SYSSECUPD_POS=21 + +# mount point of vdr video disk +VIDEO_MOUNT="/media/video" + + +# force english output for filters +LANG=en_EN + +# delete all files +rm -f [0-99]* + +if [ $SHOW_SYS_VERSION = 1 ]; then + cat /etc/os-release | grep "PRETTY_NAME=" | cut -d"\"" -f 2 > ./${SYS_VERSION_POS}_sys_version +fi + +if [ $SHOW_KERNEL_VERSION = 1 ]; then + uname -r > ./${KERNEL_VERSION_POS}_kernel_version +fi + +if [ $SHOW_UPTIME = 1 ]; then + uptime | grep -ohe 'up .*' | sed 's/,//g' | awk '{ printf $2" "$3 }' > ./${UPTIME_POS}_uptime +fi + +if [ $SHOW_LOAD = 1 ]; then + cat /proc/loadavg | awk '{print $1}' > ./${LOAD_POS}_load +fi + +if [ $SHOW_PROCESSES = 1 ]; then + ps aux | wc -l > ./${PROCESSES_POS}_processes +fi + +if [ $SHOW_MEM_USAGE = 1 ]; then + free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { printf("%3.1f%%", used/total*100)}' > ./${MEM_USAGE_POS}_mem_usage +fi + +if [ $SHOW_SWAP_USAGE = 1 ]; then + SWAP=`free -m | awk '/Swap/ {print($2)}'` + if [ $SWAP -gt 0 ]; then + free -m | awk '/Swap/ { printf("%3.1f%%", $3/$2*100) }' > ./${SWAP_USAGE_POS}_swap_usage + fi +fi + +if [ $SHOW_ROOT_USAGE = 1 ]; then + df -h / | awk '/\// {print $(NF-1)}' > ./${ROOT_USAGE_POS}_root_usage +fi + +if [ $SHOW_VIDEO_USAGE = 1 ] && [ -d ${VIDEO_MOUNT} ]; then + df -h ${VIDEO_MOUNT} | awk '/\// {print $(NF-1)}' > ./${VIDEO_USAGE_POS}_video_usage +fi + +if [ $SHOW_VDR_CPU_USAGE = 1 ]; then + vdr_pid=`pidof vdr` + if [ $? = 0 ]; then + VALUE=`ps -p ${vdr_pid} -o %cpu | awk 'NR==2{print $0}' | tr -d ' '` + echo "${VALUE}%" > ./${VDR_CPU_USAGE_POS}_vdr_cpu_usage + fi +fi + +if [ $SHOW_VDR_MEM_USAGE = 1 ]; then + vdr_pid=`pidof vdr` + if [ $? = 0 ]; then + VALUE=`ps -p ${vdr_pid} -o %mem | awk 'NR==2{print $0}' | tr -d ' '` + echo "${VALUE}%" > ./${VDR_MEM_USAGE_POS}_vdr_mem_usage + fi +fi + +if [ $SHOW_TEMPERATURES = 1 ]; then + ./../temperatures/temperatures + if [ -f ./cpu ]; then + mv ./cpu ${TEMP_CPU_POS}_cpu + fi + if [ -f ./pccase ]; then + mv ./pccase ${TEMP_PCCASE_POS}_pccase + fi + if [ -f ./gpu ]; then + mv ./gpu ${TEMP_GPU_POS}_gpu + fi +fi + +if [ $SHOW_SYSUPDATES = 1 ]; then + if [ -f ./../system_updatestatus/updates ]; then + cp ./../system_updatestatus/updates ${SYSUPD_POS}_updates + fi + if [ -f ./../system_updatestatus/security_updates ]; then + cp ./../system_updatestatus/security_updates ${SYSSECUPD_POS}_security_updates + fi +fi |