LCD への表示(5)

Debian TS-WXL

あかんやん、無限ループしているのに、 cron で10分毎に起動したら。

と言うことで、無限ループしないようにした。

#!/bin/sh

/usr/local/sbin/miconapl -a lcd_set_dispitem ipaddress date buffer0 buffer1 buffer2 buffer3 buffer4 buffer5 # buffer6 buffer7
/usr/local/sbin/miconapl -a lcd_changemode_auto

/usr/local/sbin/miconapl -a lcd_set_hostname `hostname`
/usr/local/sbin/miconapl -a lcd_set_ipaddress `ifconfig eth0 | sed -n -e 's/^.*inet addr:\([1-9][0-9\.]*\).*$/\1/p'`

# buffer0 load average
#  07:58:38 up 1 min,  1 user,  load average: 0.12, 0.04, 0.01
loadaverage=`uptime 2>/dev/null | sed -e 's/^.*load average: //'`
#                            1234567890123456
/usr/local/sbin/miconapl -a lcd_set_buffer0 "load average:   $loadaverage"


# buffer1 md0
# 012345678901234567890123456789012
# md0 : active raid1 sda1[0] sdb1[1]
MD0=`sed -n -e 's/\[[01]\]//g' -e 's/active/active   /' -e '/md0 /p' /proc/mdstat`
/usr/local/sbin/miconapl -a lcd_set_buffer1 "$MD0"

# buffer2 md1
MD1=`sed -n -e 's/\[[01]\]//g' -e 's/active/active   /' -e '/md1 /p' /proc/mdstat`
/usr/local/sbin/miconapl -a lcd_set_buffer2 "$MD1"

# buffer3 md2
MD2=`sed -n -e 's/\[[01]\]//g' -e 's/active/active   /' -e '/md2 /p' /proc/mdstat`
/usr/local/sbin/miconapl -a lcd_set_buffer3 "$MD2"



# buffer4 disk capacity
# Filesystem           1K-blocks      Used Available Use% Mounted on
# /dev/md1               4921404    747916   3923492  17% /
df | while read P T U A C M
do
        case $M in
        /)
                #                            1234567890123456789012
                /usr/local/sbin/miconapl -a lcd_set_buffer4 "/dev/md1        $M $C"
                ;;
        /mnt)
                /usr/local/sbin/miconapl -a lcd_set_buffer5 "/dev/md2        $M $C"
                ;;
        *)
        ;;
        esac
done
併せて起動時に一度実行するようにした。
tswxl:~# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/bin/sh /usr/local/sbin/fancontrol
/bin/sh /usr/local/sbin/lcdcontrol
exit 0
tswxl:~#


TS-WXL
楽天市場
amazon
Yahoo ショッピング
Livedoor デパート


LCD への表示(4)
ハックの記録
LinkStation/玄箱 をハックしよう

DTV-S100

Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市