summaryrefslogtreecommitdiff
path: root/widgets/system_information/system_information.g2v
diff options
context:
space:
mode:
authorMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2014-11-16 12:43:30 +0100
committerMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2014-11-16 12:43:30 +0100
commitefdb12a81dd96d913651b8b2bd5bbcbd8b135cbb (patch)
tree1c8b26612abe39c49fd494c32ea33554bcbaff55 /widgets/system_information/system_information.g2v
parentff62c44e6cfdf5b015d04256341e950de76c6b92 (diff)
downloadskin-flatplus-efdb12a81dd96d913651b8b2bd5bbcbd8b135cbb.tar.gz
skin-flatplus-efdb12a81dd96d913651b8b2bd5bbcbd8b135cbb.tar.bz2
update widgets
Diffstat (limited to 'widgets/system_information/system_information.g2v')
-rwxr-xr-xwidgets/system_information/system_information.g2v175
1 files changed, 175 insertions, 0 deletions
diff --git a/widgets/system_information/system_information.g2v b/widgets/system_information/system_information.g2v
new file mode 100755
index 00000000..56480fa3
--- /dev/null
+++ b/widgets/system_information/system_information.g2v
@@ -0,0 +1,175 @@
+#!/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=1
+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="/video"
+
+# force english output for filters
+LANG=en_EN
+
+# Release-File (PRETTY_NAME & VERSION)
+REL_FILE="/etc/g2v-release"
+
+# delete all files
+rm -f [0-99]*
+
+if [ $SHOW_SYS_VERSION = 1 ]; then
+ if [ -e $REL_FILE ] ; then
+ while IFS= read -r; do
+ [[ ${REPLY} =~ PRETTY_NAME ]] && declare "${REPLY}" # locale Variable
+ [[ ${REPLY} =~ VERSION ]] && declare "${REPLY}" # locale Variable
+ done < $REL_FILE
+ [ -n "$PRETTY_NAME" ] && echo "${PRETTY_NAME//\"/} ${VERSION//\"/}" > ./${SYS_VERSION_POS}_sys_version
+ fi
+fi
+
+if [ $SHOW_KERNEL_VERSION = 1 ]; then
+ uname -r > ./${KERNEL_VERSION_POS}_kernel_version
+fi
+
+if [ $SHOW_UPTIME = 1 ]; then
+ UPTIME=($(cat /proc/uptime)) # UpTime in Array
+ UPTIME[0]=${UPTIME[0]%.*} # .* entfernen (UpTime in Sekunden)
+ TAGE=$((UPTIME[0] / 86400)) ; STD=$((UPTIME[0] % 86400 / 3600))
+ MIN=$((UPTIME[0] % 3600 / 60)) ; SEK=$((UPTIME[0] % 60))
+ if [ $TAGE -ge 1 ] ; then
+ echo "${TAGE}T ${STD}S ${MIN}M" > ./${UPTIME_POS}_uptime
+ else
+ [ $STD -ge 1 ] && echo -n "${STD} Std. " > ./${UPTIME_POS}_uptime
+ echo "${MIN} Min." >> ./${UPTIME_POS}_uptime
+ fi
+fi
+
+if [ $SHOW_LOAD = 1 ]; then
+ LOADAVG=($(cat /proc/loadavg)) # Zeile in Array
+ echo "${LOADAVG[0]//./,}" > ./${LOAD_POS}_load
+fi
+
+if [ $SHOW_PROCESSES = 1 ]; then
+ PROCS=($(ls -d /proc/[0-9]*/))
+ echo "${#PROCS[@]}" > ./${PROCESSES_POS}_processes
+fi
+
+if [ $SHOW_MEM_USAGE = 1 ]; then
+ mapfile -t < <(free -m) # Ausgabe von free in Array (Vier Zeilen)
+ MEM=(${MAPFILE[1]}) # 2. Zeile
+ BUF=(${MAPFILE[2]}) # 3. Zeile
+ MEM_USAGE=$((${BUF[2]} * 1000 / ${MEM[1]}))
+ [ $MEM_USAGE -lt 10 ] && MEM_USAGE="0${MEM_USAGE}"
+ MEM_DEC=${MEM_USAGE: -1}
+ echo "${MEM_USAGE:0: -1},${MEM_DEC}%" > ./${MEM_USAGE_POS}_mem_usage
+fi
+
+if [ $SHOW_SWAP_USAGE = 1 ]; then
+ mapfile -t < <(free -m) # Ausgabe von free in Array (Vier Zeilen)
+ SWAP=(${MAPFILE[3]}) # 4. Zeile
+ if [ ${SWAP[1]} -gt 0 ]; then # Swap Total
+ if [ ${SWAP[2]} -gt 0 ]; then # Swap Used
+ SWP=$((${SWAP[2]} * 1000 / ${SWAP[1]}))
+ [ $SWP -lt 10 ] && SWP="0${SWP}"
+ SWP_DEC=${SWP: -1} ; SWP=${SWP:0: -1},${SWP_DEC}
+ echo "${SWP}%" > ./${SWAP_USAGE_POS}_swap_usage
+ else
+ echo "0,0%" > ./${SWAP_USAGE_POS}_swap_usage
+ fi
+ fi
+fi
+
+if [ $SHOW_ROOT_USAGE = 1 ]; then
+ mapfile -t < <(df -Ph /) # Ausgabe von df in Array (Zwei Zeilen)
+ ROOTUSAGE=(${MAPFILE[1]}) # 2. Zeile in Array
+ # Beispiel 2. Zeile: tmpfs 128M 30M 99M 23% /root
+ echo "${ROOTUSAGE[4]}" > ./${ROOT_USAGE_POS}_root_usage
+fi
+
+if [ $SHOW_VIDEO_USAGE = 1 ] && [ -d ${VIDEO_MOUNT} ]; then
+ mapfile -t < <(df -Ph ${VIDEO_MOUNT}) # Ausgabe von df in Array (Zwei Zeilen)
+ VIDEOUSAGE=(${MAPFILE[1]}) # 2. Zeile in Array
+ # Beispiel 2. Zeile: tmpfs 128M 30M 99M 23% /root
+ echo "${VIDEOUSAGE[4]}" > ./${VIDEO_USAGE_POS}_video_usage
+fi
+
+if [ $SHOW_VDR_CPU_USAGE = 1 ]; then
+ vdr_pid=$(pidof vdr)
+ if [ $? = 0 ]; then
+ mapfile -t < <(ps -p ${vdr_pid} -o %cpu) # Ausgabe von ps in Array (Zwei Zeilen)
+ CPU_USAGE=${MAPFILE[1]/./,} # 24.2 -> 24,2
+ echo "${CPU_USAGE}%" > ./${VDR_CPU_USAGE_POS}_vdr_cpu_usage
+ fi
+fi
+
+if [ $SHOW_VDR_MEM_USAGE = 1 ]; then
+ vdr_pid=$(pidof vdr)
+ if [ $? = 0 ]; then
+ mapfile -t < <(ps -p ${vdr_pid} -o %mem) # Ausgabe von ps in Array (Zwei Zeilen)
+ VDR_MEM_USAGE=${MAPFILE[1]/./,} # 24.2 -> 24,2
+ echo "${VDR_MEM_USAGE}%" > ./${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