kill in stop script

This commit is contained in:
Gerrit Linnemann 2015-11-15 23:18:09 +01:00
parent 1e984c2b2e
commit c0df1a1aed
3 changed files with 5 additions and 15 deletions

View File

@ -20,8 +20,6 @@ var Log = null
var Helper = null; var Helper = null;
var Conf = null; var Conf = null;
var Child = null;
exports.init = function(Express, Configuration) { exports.init = function(Express, Configuration) {
App = Express; App = Express;
@ -70,18 +68,7 @@ exports.play = function(idx) {
download.on('end', function(output) { download.on('end', function(output) {
Log.inspect('Radio: Download completed', output); Log.inspect('Radio: Download completed', output);
if(Helper.isDefinedAndNotNull(Child)) { Helper.shspawn(App.get('tools_root')+'action.sh stop');
// kill active instances
try {
Child.kill();
} catch(err) {
Log.error('Radio: Error killing process');
}
}
Child.stdin.pause();
Child.kill();
Helper.shspawn(App.get('tools_root')+'action.sh play'); Helper.shspawn(App.get('tools_root')+'action.sh play');
}); });

View File

@ -10,9 +10,10 @@ MY_PATH="$(pwd)"
### PRORGAM ### PRORGAM
echo "Action: $1" #echo "Action: $1"
case $1 in case $1 in
"play") sh $MY_PATH/bin/start_radio.sh ;; "play") sh $MY_PATH/bin/start_radio.sh ;;
"stop") sh $MY_PATH/bin/stop_radio.sh ;;
*) echo "INVALID ACTION!" ;; *) echo "INVALID ACTION!" ;;
esac esac

View File

@ -13,3 +13,5 @@ MY_PATH="$(pwd)"
echo echo
echo "${BGre}Stop playing ...${RCol}" echo "${BGre}Stop playing ...${RCol}"
echo echo
pkill -f mplayer