src.h
#/bin/sh
echo '
#!/bin/sh
function StartWatchdog()
{
echo "start gpio watchdog"
echo 21 > /sys/class/gpio/export
echo out > /sys/class/gpio/pioA21/direction
echo "run here"
while [ 1 ];
do
echo 1 > /sys/class/gpio/pioA21/value
sleep 0.1
echo 0 > /sys/class/gpio/pioA21/value
sleep 0.1
done
}
pkill testAPP
StartWatchdog&' > gen.sh
chmod 777 ./gen.sh
pwd
nohup ./gen.sh > output.file 2>&1 &
自动生成脚本
#!/bin/sh
function StartWatchdog()
{
echo "start gpio watchdog"
echo 21 > /sys/class/gpio/export
echo out > /sys/class/gpio/pioA21/direction
echo "run here"
while [ 1 ];
do
echo 1 > /sys/class/gpio/pioA21/value
sleep 0.1
echo 0 > /sys/class/gpio/pioA21/value
sleep 0.1
done
}
pkill testAPP
StartWatchdog&