Start, Stop Shell
start shell
#!/bin/bash
echo
echo '##### START Submarine #####'
echo
wpa_cli -i wlan0 status
echo
echo
FILENAME=/home/hyunsu/submarine/nohup.out
if [ -f "$FILENAME" ] ; then
echo "nohup.out delete !"
rm /home/hyunsu/submarine/nohup.out
else
echo "file not exist"
fi
echo '##### START CCTV #####'
cd /home/hyunsu/submarine
nohup python3 /home/hyunsu/submarine/SubMarine.py &
sleep 3
echo '##### START BROD SOUND #####'
hwString=`pactl list | grep -A 40 'Source' | grep -A 20 'device.bus = "usb"' | grep 'device.string' | grep -o '[0-9]'`
echo -e "\n Mic HW = [$hwString]"
nohup cvlc -vvv alsa://plughw:$hwString --sout '#transcode{acodec=mp3,ab=64,channels=1}:standard{access=http,dst=0.0.0.0:8080/out.mp3}' 1> /dev/null 2>&1 &
echo
echo '##### STARTed Submarine #####'
echo
Stop shell
#!/bin/bash
echo
echo '##### STOP Submarine #####'
echo
ps -ef | grep SubMarine.py | grep -v grep
KILLPID=`ps -ef | grep SubMarine.py | grep -v grep | awk '{print($2)}'`
echo "Stop Submarine Process = " $KILLPID
kill -9 $KILLPID
sleep 3
ps -ef | grep vlc | grep -v grep
KILLPID=`ps -ef | grep vlc | grep -v grep | awk '{print($2)}'`
echo "Stop Brod Sound Process = " $KILLPID
kill -9 $KILLPID
sleep 3
echo
echo '##### STOPed Submarine #####'
echo