I created gulpfile.js to run my servers, and its contents can be seen below.
gulp.task('default', function () { if(!fs.statSync('/etc/aptly.conf').isFile()){ process.exit(); return; } console.info('Starting static file server SimpleHTTPServer on 0.0.0.0:8080'); aptly_static = spawn('python', ['-m', 'SimpleHTTPServer', '8080'], {'cwd': '/opt/aptly/public', 'stdio': 'inherit'}); console.info('Starting Django runserver on 0.0.0.0:8000'); django = spawn('python', ['manage.py', 'runserver', '0.0.0.0:8000'], {'stdio': 'inherit'}); console.info('Starting Aptly api serve on 0.0.0.0:4416'); aptly_api = run('aptly api serve -listen="0.0.0.0:4416"').exec().pipe(gulp.dest('/tmp/aptlylog')); return watchLess('src/**/*.less') .pipe(debug()) .pipe(reLess) .pipe(gulp.dest('dist/dist'));
The problem is that at least due to preprocessor crashes, the gulpfile.js daemon crashes. The python manage.py runserver child processes python manage.py runserver python -m SimpleHTTPServer aptly api serve will still work.
I had to stop them thoroughly using ps -aux | grep runserver ps -aux | grep runserver and likewise, to find the PID to delete via sudo kill -9 $PID .
Is there a way to directly kill all processes if my gulpfile.js unexpectedly fails?
source share