Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let a few services continuously running (daemon) using plumber. #23

Closed
sahilseth opened this issue Oct 8, 2015 · 4 comments
Closed

Comments

@sahilseth
Copy link

What would be the recommended way to create a daemon using plumber ?

## if plum is a script which contain all the commands
plum.R
## running from terminal using & should work
Rscript plum.R &

issues
Issue is what if I press this twice, and there are two conflicting scripts running on the same port.
What is someone else does the same.

Possible to check all plumber services running (given a port)?

@trestletech
Copy link
Contributor

Thanks for opening this. This is something I'm actively thinking about. I don't think the solution belongs in plumber, since R's forte is not load balancing and managing processes, but I have a poked around at a couple of other tools that can be used to accomplish at least some of these purposes. I'll get them written up shortly.

trestletech added a commit that referenced this issue Oct 10, 2015
Touches #23.

Create empty path-to-port article.
@trestletech
Copy link
Contributor

I've started writing this up here: http://plumber.trestletech.com/docs/hosting/

@rauno56
Copy link

rauno56 commented May 17, 2016

You can set the port as a command line argument to your bash script:

#!/bin/bash

port=${1:-9002}

kill $(ps aux | grep "$port" | grep plumb | awk '{print $2}')
R --vanilla -e "library(plumber); pr <- plumb('query.api.r'); pr\$run(port=$port)"

kill makes sure you don't get the "port already in use"-error - Sometimes the port will stay in use even after the actual process is shut down.

EDIT. Going through the documentation I realized that any of my solution is original. Removed most of the parts from the official documentation.

@trestletech
Copy link
Contributor

Between the above link and http://plumber.trestletech.com/docs/docker/, I'm calling this closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants