Trying to use grunt-kill to create a task that will kill my server-scorm
task, and eventually any related tasks. The instructions are extremely short because it assumes I know all about PID files (which I don't, not the devs fault) and Grunt Manual makes 0 reference to them.
The problem is that I don't know how to properly reference the PID file path and what naming scheme Grunt uses.
I can get the the IDs when I run the following command:
ps aux | grep grunt
But of course that does me no good when the PID changes every time, so I can't directly reference it.
The instructions say to put this in the config:
kill: {
myService: {
src: [ 'my-service.pid' ]
},
secondary: {
pid: 'secondary.pid'
}
}
This is one example of how to use it... but ['my-service.pid']
I have no idea how to get to that.
In my case, the name of the command grunt task I'm trying to kill is server-scorm
so I assumed it was:
kill: {
serverScorm: {
src: [ 'server-scorm.pid' ]
},
}
of course when I run it, it doesn't recognize it. I get this:
seems that the missing piece to this puzzle is that I can't get to the server-scorm.pid or what ever its called.
If you're wondering why I'm not using cntrl+c
it's the team is using an IDE called brackets and it "nicely" provides a grunt interface where all you have to do is click a button and it will run a command... As you may have guessed, there is no place where you can input commands like that.
I am copying my answer from your bug report on GitHub.
Hi @phillt The grunt-kill
plugin cannot natively determine the pid for any process because without a pid, how would it know which process you want? Each application's way of "discovering" it could be different, and it could even be running multiple processes.
There are two ways for this plugin to determine the pid:
grunt-kill
can read that file and know which process to kill. For example, the Apache web server on RedHat typically writes its pid file to something like /var/run/httpd.pid
. I am not familiar with server-scorm, so cannot say for sure if it uses a pid file. grunt-kill
will happily execute it to discover the PID. You can probably put some filters around ps aux to find the pid. Maybe filter by process name and user login name? On a side-note, I work in the e-learning space, so server-scorm and the adapt framework is going to give me some homework. :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.