My IBM MobileFirst Platform 7.1 CLI-based server h

2019-04-15 11:32发布

问题:

I'm working with an IBM MobileFirst Platform 7.1 server supported by the Command-Line interface; however, my server isn't starting and stopping correctly. How can I recreate it easily from scratch in one command?

回答1:

You might also give the "MFP eXtras" project a try --> https://github.com/kfbishop/mfpx

The mfpx kill command will stop server, kill processes, clean tmp dirs, etc. MFPX is not supported / endorsed by IBM, just me (and AndrewF :). Feedback welcomed.



回答2:

This chain of commands forcibly kills your MobileFirst server, then deletes it and recreates it from scratch:

  • kill -9 $(cat ~/.ibm/mobilefirst/7.1.*/server/wlp/usr/servers/.pid/worklight.pid) - Forcibly kill your MobileFirst server using its process ID.
  • (sudo lsof -i tcp:10080 | awk "NR!=1 {print $2}" | xargs kill -9) - In case that missed it (in the rare case where it hasn't persisted its process ID correctly), kill any process listening on TCP port 10080. (Be careful. This assumes that MobileFirst is the only server which ever listens on TCP port 10080 on your system. If this is not the case, you may inadvertently kill another server.)
  • mfp server remove - Remove the MFP server using the MFP CLI
  • rm -R ~/.ibm/mobilefirst/7.1.*/ - Clean up any remaining logs and other junk.
  • rm -R $TMPDIR/wlBuildResources - Remove the wlBuildResources directory, which the CLI uses to build projects.
  • rm -R $TMPDIR/wlPreview - Remove the wlPreview directory, which the CLI uses to preview projects.
  • mfp server create && mfp start - Create a new server and start it.

On my system I have this entire chain set up as a shell alias to easily recreate my MFP server when needed.

The mfpx project also does something similar with the mfpx kill command.