Stop detached strongloop application

Ran Hassid

I installed loopback on my server (ubuntu) and then created an app and use the command slc run to run... everything works as expected. Now i have 1 question and also 1 issue i am facing with:

The question: i need to use slc run command but to keep the app "alive" also after i close the terminal. For that i used the --detach option and it works, What i wanted to know if the --detach option is the best practice or i need to do it in a different way.

The issue: After i use the --detach i don't really know how to stop it. Is there a command that i can use to stop the process from running?

Ryan Graham

To stop a --detached process, go to the same directory it was run from and do slc runctl stop. There are a number of runctl commands, but stop is probably the one you are most interested in.

Best practices is a longer answer. The short version is: don't use --detach ever and do use an init script to run your app and keep it running (probably Upstart, since you're on Ubuntu).

Using slc run

If you wan to run slc run as an Upstart job you can install strong-service-install with npm install -g strong-service-install. This will give you sl-svc-install, a utility for creating Upstart and systemd services.

You'll end up running something like sudo sl-svc-install --name my-app --user youruser --cwd /path/to/app/root -- slc run . which should create a Upstart job named my-app which will run your app as your uid from the app's root. Your app's stdout/stderr will be sent to /var/log/upstart/my-app.log. If you are using a version of Ubuntu older than 12.04 you'll need to specify --upstart 0.6 and your logs will end up going to syslog instead.

Using slc pm

Another, possibly easier route, is to use slc pm, which operates at a level above slc run and happens to be easier to install as an OS service. For this route you already have everything installed. Run sudo slc pm-install and a strong-pm Upstart service will be installed as well as a strong-pm user to run it as with a $HOME of /var/lib/strong-pm.

Where the PM approach gets slightly more complicated is that you have to deploy your app to it. Most likely this is just a matter of going to your app root and running slc deploy http://localhost:8701/, but the specifics will depend on your app. You can configure environment variables for your app, deploy new versions, and your logs will show up in /var/log/upstart/strong-pm.log.

General Best Practices

For either of the options above, I recommend not doing npm install -g strongloop on your server since it includes things like yeoman generators and other tools that are more useful on a workstation than a server.

If you want to go the slc run route, you would do npm install -g strong-supervisor strong-service-install and replace your slc run with sl-run.

If you want to go the slc pm route, you would do npm install -g strong-pm and replace slc pm-install with sl-pm-install.

Disclaimer

I work at StrongLoop and primarily work on these tools.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to stop a detached process in qt?

From Dev

How do I Stop a Strongloop Service?

From Dev

How to terminate or stop a detached thread in c++?

From Dev

Is there a reliable way to force a thread to stop in C++? (especially detached ones)

From Dev

How to run a detached application by terminal command in Qt application?

From Dev

Quietly stop an application

From Dev

Application unfortunately stop in android

From Dev

Force Stop android application

From Dev

Wait for an launched application to stop

From Dev

With Jekyll, how do I stop a detached server process from the command line?

From Dev

Keyboard shortcut to stop application in QtCreator

From Dev

Rails Byebug Did Not Stop Application

From Dev

Application.stop(...) in Elixir shell

From Dev

How to stop an application auto starting

From Dev

Stop a service when application is in background

From Dev

stop Application Insight automatically installed

From Dev

How to stop timer in a swing application

From Dev

Application Verifier Stop: An HKEY was leaked

From Dev

How to Stop GIF in iOS application?

From Dev

where to check out the screen detached command line application crash log on Ubuntu

From Dev

Spring webapp - shutting down threads on Application stop

From Dev

How to stop a Vibe.D application?

From Dev

Programmatically stop Java EE application during initializaton

From Dev

How to stop rails nginx-passenger application?

From Dev

How to stop an OSGI Application from command line

From Dev

Shell script to stop an application at power down in linux

From Dev

Android : Some time service is stop in some application

From Dev

Stop Intents from Opening my Application

From Dev

Start/stop a timer when a specific application is opened

Related Related

  1. 1

    How to stop a detached process in qt?

  2. 2

    How do I Stop a Strongloop Service?

  3. 3

    How to terminate or stop a detached thread in c++?

  4. 4

    Is there a reliable way to force a thread to stop in C++? (especially detached ones)

  5. 5

    How to run a detached application by terminal command in Qt application?

  6. 6

    Quietly stop an application

  7. 7

    Application unfortunately stop in android

  8. 8

    Force Stop android application

  9. 9

    Wait for an launched application to stop

  10. 10

    With Jekyll, how do I stop a detached server process from the command line?

  11. 11

    Keyboard shortcut to stop application in QtCreator

  12. 12

    Rails Byebug Did Not Stop Application

  13. 13

    Application.stop(...) in Elixir shell

  14. 14

    How to stop an application auto starting

  15. 15

    Stop a service when application is in background

  16. 16

    stop Application Insight automatically installed

  17. 17

    How to stop timer in a swing application

  18. 18

    Application Verifier Stop: An HKEY was leaked

  19. 19

    How to Stop GIF in iOS application?

  20. 20

    where to check out the screen detached command line application crash log on Ubuntu

  21. 21

    Spring webapp - shutting down threads on Application stop

  22. 22

    How to stop a Vibe.D application?

  23. 23

    Programmatically stop Java EE application during initializaton

  24. 24

    How to stop rails nginx-passenger application?

  25. 25

    How to stop an OSGI Application from command line

  26. 26

    Shell script to stop an application at power down in linux

  27. 27

    Android : Some time service is stop in some application

  28. 28

    Stop Intents from Opening my Application

  29. 29

    Start/stop a timer when a specific application is opened

HotTag

Archive