# not tested: # supervise closes descriptors properly # svc -p # svscanboot echo '--- supervise starts, svok works, svup works, svstat works, svc -x works' supervise test.sv & while not svok test.sv { sleep 1 } svup test.sv; echo $Status svup -l test.sv; echo $Status svup -L test.sv; echo $Status shell { svstat test.sv; echo $Status; } | filter_svstat svc -x test.sv; echo $Status wait svstat test.sv; echo $Status echo '--- svc -ox works' supervise test.sv & while not svok test.sv { sleep 1 } svc -ox test.sv wait echo '--- svstat and svup work for up services' catexe test.sv/run << """ #!/bin/sh sleep 1 svstat . echo $Status svstat -l . echo $Status svstat -L . echo $Status svup . echo '$'? svup -L . echo '$'? svup -l . echo '$'? """ supervise test.sv | filter_svstat & while not svok test.sv { sleep 1 } svc -ox test.sv wait echo '--- svstat and svup work for logged services' catexe test.sv/run << """ #!/bin/sh sleep 1 svstat . echo $Status svstat -l . echo $Status svstat -L . echo $Status svup . echo '$'? svup -L . echo '$'? svup -l . echo '$'? """ catexe test.sv/log << """ #!/bin/sh exec cat """ supervise test.sv | filter_svstat & while not svok test.sv { sleep 1 } svc -Lolox test.sv wait rm -f test.sv/log echo '--- svc -u works' shell { echo '#!/bin/sh'; echo echo first; echo mv run2 run } > test.sv/run chmod 755 test.sv/run shell { echo '#!/bin/sh'; echo echo second; echo svc -x . } > test.sv/run2 chmod 755 test.sv/run2 supervise test.sv & while not svok test.sv { sleep 1 } svc -u test.sv wait