Code Sample |
#!/usr/bin/perl &style2; sub style1 { open (songs, ">azt2320.sh"); print songs <<"eohtml"; date echo ***********************************azt2320**************************** eohtml for ($irq=2;$irq<=13;$irq++) { for ($dma=0;$dma<=7;$dma++) { for ($dma2=0;$dma2<=7;$dma2++) { print songs <<"eohtml"; sleep 3 sudo modprobe -v ad1848 io=0x220 irq=$irq dma=$dma dma2=$dma2 isapnp=0 sleep 5 rmmod ad1848 date eohtml } } } close (songs); exit; } sub style2 { $errstring="fail"; $sst="/opt/findisapnp.sh >/mnt/hda4/findisapnp.txt"; for ($irq=2;$irq<=13;$irq++) { for ($dma=0;$dma<=7;$dma++) { for ($dma2=0;$dma2<=7;$dma2++) { open (songs, ">/opt/findisapnp.sh"); print songs <<"eohtml"; echo ========================================================================== echo modprobe -v ad1848 io=0x220 irq=$irq dma=$dma dma2=$dma2 isapnp=0 echo echo date echo ***********************************azt2320**************************** sudo modprobe -v ad1848 io=0x220 irq=$irq dma=$dma dma2=$dma2 isapnp=0 sleep 2 rmmod ad1848 date eohtml close (songs); system ($sst); open (songs, "/mnt/hda4/findisapnp.txt"); @tmp=<songs>; close (songs); $error="false"; $errstring="failed"; for ($j=0;$j<=$#tmp;$j++) { $null=chomp($tmp[$j]); print "$tmp[$j]\n"; if (@null = ($tmp[$j] = ~ m/$errstring/i)) { $error="true"; } print "$error"; } if ($error ne "true") { print "$tmp[0]\n\n might have worked\n\nexiting....\n"; exit; } } } } } exit; |