Is it possible to run Gulp script with forever?
I have Gulp script that would like to run as a daemon, so I could start / stop / list it.
Is it possible to run Gulp script with forever?
I have Gulp script that would like to run as a daemon, so I could start / stop / list it.
To give you a programatic answer:
You use the underlying forever-monitor which contains the core functionality which the
forever
CLI package uses.You can run multiples of such tasks, you don't need to use special daemon options since gulp tasks use orchestrator under the hood which runs tasks concurrently.
If using CMD+C in the console is not suitable to stop your tasks then you can put it into a variable:
if you install
gulp
in your node project, you can do like this:forever start node_modules/gulp/bin/gulp.js [YOUR GULP TASK]
Try this:
forever start -c "gulp" serve
The
-c
option allows you to use any command.Okay, so I solved it by linking the gulp binary from /usr/bin to my local folder and then simply running the command locally. Like so:
The commands may vary for you but I hope you get the gist of it.
Install
pm2
Now start
gulp
You can view running services using
pm2 l
and Note: sometimes you can see your services running on next to port you specified example: http://localhost:3001 instead of http://localhost:3000