diff options
Diffstat (limited to 'widgets/system_information/system_information.ubuntu')
-rwxr-xr-x | widgets/system_information/system_information.ubuntu | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/widgets/system_information/system_information.ubuntu b/widgets/system_information/system_information.ubuntu index 5d4c98a2..36c82896 100755 --- a/widgets/system_information/system_information.ubuntu +++ b/widgets/system_information/system_information.ubuntu @@ -3,6 +3,12 @@ # this script will be executed when the widget will be drawn # so make it short and fast +OUTPUTFLDR="/tmp/skinflatplus/widgets/system_information" +mkdir -p ${OUTPUTFLDR} + +OUTPUTFLDRTEMP="/tmp/skinflatplus/widgets/temperatures" +OUTPUTFLDRSUPD="/tmp/skinflatplus/widgets/system_updatestatus" + # enable/disable items SHOW_SYS_VERSION=0 SHOW_KERNEL_VERSION=0 @@ -16,8 +22,8 @@ SHOW_VIDEO_USAGE=1 SHOW_VDR_CPU_USAGE=1 SHOW_VDR_MEM_USAGE=1 -SHOW_TEMPERATURES=0 -SHOW_SYSUPDATES=0 +SHOW_TEMPERATURES=1 +SHOW_SYSUPDATES=1 # Position of items # sys_version & kernel_version are drawn in one line @@ -54,14 +60,14 @@ VIDEO_MOUNT="/media/video" LANG=en_EN # delete all files -rm -f [0-99]* +rm -f ${OUTPUTFLDR}/[0-99]* if [ $SHOW_SYS_VERSION = 1 ]; then - cat /etc/os-release | grep "PRETTY_NAME=" | cut -d"\"" -f 2 > ./${SYS_VERSION_POS}_sys_version + cat /etc/os-release | grep "PRETTY_NAME=" | cut -d"\"" -f 2 > ${OUTPUTFLDR}/${SYS_VERSION_POS}_sys_version fi if [ $SHOW_KERNEL_VERSION = 1 ]; then - uname -r > ./${KERNEL_VERSION_POS}_kernel_version + uname -r > ${OUTPUTFLDR}/${KERNEL_VERSION_POS}_kernel_version fi if [ $SHOW_UPTIME = 1 ]; then @@ -70,21 +76,21 @@ if [ $SHOW_UPTIME = 1 ]; then 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 + echo "${TAGE}T ${STD}S ${MIN}M" > ${OUTPUTFLDR}/${UPTIME_POS}_uptime else - [ $STD -ge 1 ] && echo -n "${STD} Std. " > ./${UPTIME_POS}_uptime - echo "${MIN} Min." >> ./${UPTIME_POS}_uptime + [ $STD -ge 1 ] && echo -n "${STD} Std. " > ${OUTPUTFLDR}/${UPTIME_POS}_uptime + echo "${MIN} Min." >> ${OUTPUTFLDR}/${UPTIME_POS}_uptime fi fi if [ $SHOW_LOAD = 1 ]; then LOADAVG=($(cat /proc/loadavg)) # Zeile in Array - echo "${LOADAVG[0]//./,}" > ./${LOAD_POS}_load + echo "${LOADAVG[0]//./,}" > ${OUTPUTFLDR}/${LOAD_POS}_load fi if [ $SHOW_PROCESSES = 1 ]; then PROCS=($(ls -d /proc/[0-9]*/)) - echo "${#PROCS[@]}" > ./${PROCESSES_POS}_processes + echo "${#PROCS[@]}" > ${OUTPUTFLDR}/${PROCESSES_POS}_processes fi if [ $SHOW_MEM_USAGE = 1 ]; then @@ -94,7 +100,7 @@ if [ $SHOW_MEM_USAGE = 1 ]; then 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 + echo "${MEM_USAGE:0: -1},${MEM_DEC}%" > ${OUTPUTFLDR}/${MEM_USAGE_POS}_mem_usage fi if [ $SHOW_SWAP_USAGE = 1 ]; then @@ -105,19 +111,19 @@ if [ $SHOW_SWAP_USAGE = 1 ]; then 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 + echo "${SWP}%" > ${OUTPUTFLDR}/${SWAP_USAGE_POS}_swap_usage else - echo "0,0%" > ./${SWAP_USAGE_POS}_swap_usage + echo "0,0%" > ${OUTPUTFLDR}/${SWAP_USAGE_POS}_swap_usage fi fi fi if [ $SHOW_ROOT_USAGE = 1 ]; then - df -h / | awk '/\// {print $(NF-1)}' > ./${ROOT_USAGE_POS}_root_usage + df -h / | awk '/\// {print $(NF-1)}' > ${OUTPUTFLDR}/${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 + df -h ${VIDEO_MOUNT} | awk '/\// {print $(NF-1)}' > ${OUTPUTFLDR}/${VIDEO_USAGE_POS}_video_usage fi if [ $SHOW_VDR_CPU_USAGE = 1 ]; then @@ -125,7 +131,7 @@ if [ $SHOW_VDR_CPU_USAGE = 1 ]; then 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 + echo "${CPU_USAGE}%" > ${OUTPUTFLDR}/${VDR_CPU_USAGE_POS}_vdr_cpu_usage fi fi @@ -134,28 +140,28 @@ if [ $SHOW_VDR_MEM_USAGE = 1 ]; then 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 + echo "${VDR_MEM_USAGE}%" > ${OUTPUTFLDR}/${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 + if [ -f ${OUTPUTFLDRTEMP}/cpu ]; then + cp ${OUTPUTFLDRTEMP}/cpu ${OUTPUTFLDR}/${TEMP_CPU_POS}_cpu fi - if [ -f ./pccase ]; then - mv ./pccase ${TEMP_PCCASE_POS}_pccase + if [ -f ${OUTPUTFLDRTEMP}/pccase ]; then + cp ${OUTPUTFLDRTEMP}/pccase ${OUTPUTFLDR}/${TEMP_PCCASE_POS}_pccase fi - if [ -f ./gpu ]; then - mv ./gpu ${TEMP_GPU_POS}_gpu + if [ -f ${OUTPUTFLDRTEMP}/gpu ]; then + cp ${OUTPUTFLDRTEMP}/gpu ${OUTPUTFLDR}/${TEMP_GPU_POS}_gpu fi fi if [ $SHOW_SYSUPDATES = 1 ]; then - if [ -f ./../system_updatestatus/updates ]; then - cp ./../system_updatestatus/updates ${SYSUPD_POS}_updates + if [ -f ${OUTPUTFLDRSUPD}/updates ]; then + cp ${OUTPUTFLDRSUPD}/updates ${OUTPUTFLDR}/${SYSUPD_POS}_updates fi - if [ -f ./../system_updatestatus/security_updates ]; then - cp ./../system_updatestatus/security_updates ${SYSSECUPD_POS}_security_updates + if [ -f ${OUTPUTFLDRSUPD}/security_updates ]; then + cp ${OUTPUTFLDRSUPD}/security_updates ${OUTPUTFLDR}/${SYSSECUPD_POS}_security_updates fi fi |