Skip to content

Instantly share code, notes, and snippets.

@dwbapst
Created December 16, 2019 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwbapst/5f8e623ea42abacfee25ecb837fad945 to your computer and use it in GitHub Desktop.
Save dwbapst/5f8e623ea42abacfee25ecb837fad945 to your computer and use it in GitHub Desktop.
trying to make a persistent rb 12-16-19
# persistent_rb_eng_via_nohup.R
# to initiate rb:
mkfifo in_revbayes
# nohup rb <in_revbayes >out.txt &
# to run a sample of code (here 'x = 3+111')
# (echo -e "x = 3+111\n" && cat) > in_revbayes &
# to collect output, check:
# cat out.txt
# to terminate rb process from within
# echo -e "q()\n" > in_revbayes &
# to initiate rb:
unlink("in_revbayes")
unlink("out_revbayes.txt")
system2(command = "mkfifo", args = "in_revbayes")
#system2(command = "nohup", args = "rb <in_rev >out.txt &")
system("nohup rb <in_revbayes >out_revbayes.txt &")
# system2(command = "rb", args = "&", stdin ="in_rev", stdout = "out.txt")
system("pidof rb")
system2(command = "pidof", args ="rb")
# to run a sample of code (here 'x = 3+111')
# (echo -e "x = 3+111\n" && cat) > in_revbayes &
command <- '(echo -e \"x = 3+111\n\" && cat) > in_revbayes &'
#command <- shQuote(command)
system(command)
command <- "(echo -e \"x+1\n\" && cat) > in_revbayes &"
#command <- shQuote(command)
system(command)
# to terminate rb process from within
system('echo -e \"q()\n\" > in_revbayes &')
# to collect output, check:
readLines("out_revbayes.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment