zapty / forever-service

Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS
https://github.com/zapty/forever-service
MIT License
594 stars 65 forks source link

RHEL/AL2 init script no longer works with forever v4.0.3 #105

Closed mmrwoods closed 2 years ago

mmrwoods commented 2 years ago

Forever version 4.0.3 changes the output from forever --plain list slightly which breaks the init script generated by forever-service because the regex to parse the output and determine the status of running services no longer works.

With forever v4.0.2, forever --plain list generates output like this:

info:    Forever processes running
data:        uid        command       script  forever pid  id logfile                 uptime
data:    [0] contentapi /usr/bin/node bin/www 7873    7927    /var/log/contentapi.log 75:20:4:18.05599999986589

With forever v4.0.3, forever --plain list generates output like this:

info:    Forever processes running
data:undefined    uid        command       script  forever pid  id logfile                 uptime
data:undefined[0] contentapi /usr/bin/node bin/www 8044    8113    /var/log/contentapi.log 0:0:16:20.09299999999996

That undefined after data: breaks the init script created by forever-service as it relies on a regex matching whitespace after data: to identify running services.

I've reported this to the author of the relevant PR which introduced the change at https://github.com/foreversd/forever/pull/1128#issuecomment-1025476725 and it has been acknowledged as an issue, but that does not necessarily mean a fix is imminent.

In the meantime, I have pinned forever to version 4.0.2, but maybe the status regex in the init script generated by forever-service should be updated though to look for a sequence of characters not matching [ rather than one or more spaces? (having said that, this is code I'm not really familiar with, it's just an issue I ran into earlier today, so I might be missing some obvious constraints here)

arvind-agarwal commented 2 years ago

Thanks @mmrwoods for reporting the issue here. But it is better to fix forever bug instead of making changes in this repo in this case.

arvind-agarwal commented 2 years ago

If changes are needed after fixing forever bug certainly i will consider it.

mmrwoods commented 2 years ago

Thanks @arvind-agarwal, looks like it will get fixed on forever soon.

P.S. Sorry about delay following up, just a busy few days.