#!/bin/sh # Sample autorun script cd `dirname $0` # Turn on the red LED echo 1 > /sys/class/leds/red/brightness [ -f cuImage.warp ] && warploader -p kernel cuImage.warp [ -f uRamdisk ] && warploader -p root uRamdisk kill_processes () { local PS=`ps` if echo $PS | fgrep -q httpd ; then echo "httpd must be shut down" killall httpd sleep 5 PS=`ps` if echo $PS | fgrep -q httpd ; then echo "httpd will not die" killall -9 httpd sleep 5 PS=`ps` if echo $PS | fgrep -q httpd ; then echo "It looks like httpd is a zombie" fi fi fi local PS=`ps` if echo $PS | fgrep -q tftpd ; then echo "tftpd must be shut down" killall tftpd sleep 5 PS=`ps` if echo $PS | fgrep -q tftpd ; then echo "tftpd will not die" killall -9 tftpd sleep 5 PS=`ps` if echo $PS | fgrep -q tftpd ; then echo "It looks like tftpd is a zombie" fi fi fi echo "Shutting down Asterisk and Astmanproxy" svc -d /service/asterisk svc -d /service/astmanproxy echo "Logging out all users to ensure there are no user files open on persistent." for pid in `ps | awk '/-sh/ { print $1 }'` ; do kill -9 $pid; done } unmount_persistent () { if mount | fgrep -q /persistent ; then kill_processes umount /persistent || { logger "Unable to unmount persistent"; return 1; } fi return 0 } # Persistent is a bit trickier since we must unmount before flashing if [ -f image.jffs2 ] ; then if unmount_persistent ; then warploader -p persistent image.jffs2 fi fi # Turn off red led echo 0 > /sys/class/leds/red/brightness