Added shiny-matrix.sh, and now chertex.sh updates the Shiny matrix.

master
Taha Ahmed 11 years ago
parent 59e38ea466
commit a6daa3aced

@ -123,8 +123,14 @@ if [ $# -eq 1 ]; then
# If $jobname is sample-matrix, run knitr and markdown # If $jobname is sample-matrix, run knitr and markdown
if [[ $jobname == "sample-matrix" ]]; then if [[ $jobname == "sample-matrix" ]]; then
echo "<cheRTeX> -----------------------------------------------------------" echo "<cheRTeX> -----------------------------------------------------------"
echo "<cheRTeX> sample-matrix detected: running knit() and markdownToHTML()" echo "<cheRTeX> sample-matrix: update SHINY, run knit() + markdownToHTML()"
echo "<cheRTeX> -----------------------------------------------------------" echo "<cheRTeX> -----------------------------------------------------------"
# Old attempts, never worked
#PORT=$(</home/taha/chepec/chetex/sample-matrix/shinyapp/shiny.port)
#bash -c "R -e 'shiny::runApp(\"/home/taha/chepec/chetex/sample-matrix/shinyapp\", port = $PORT)'"
bash -c "shiny-matrix.sh" &
Rscript -e "library(knitr); knit(input='$jobname.Rmd', output='$jobname.md')" Rscript -e "library(knitr); knit(input='$jobname.Rmd', output='$jobname.md')"
Rscript -e "library(markdown); markdownToHTML('$jobname.md', '$jobname.html', stylesheet = 'custom.css')" Rscript -e "library(markdown); markdownToHTML('$jobname.md', '$jobname.html', stylesheet = 'custom.css')"
fi fi

@ -6,7 +6,11 @@
a="https://mail.google.com" a="https://mail.google.com"
b="https://rememberthemilk.com" b="https://rememberthemilk.com"
c="https://chepec.timetask.com" c="https://chepec.timetask.com"
# open shiny sample-matrix
# find current port number by reading shiny.port file
PORT=$(</home/taha/chepec/chetex/sample-matrix/shinyapp/shiny.port)
d="localhost:$PORT"
google-chrome $a $b $c google-chrome $a $b $c $d
exit 1 exit 1

@ -0,0 +1,27 @@
#!/bin/bash
## Start R Shiny app "sample-matrix"
## Written Dec 22, 2013
## Taha Ahmed
## bash /home/taha/chepec/chetex/common/bash/shiny-matrix.sh
# Random port number between 2000 and 10000
PORT=$(shuf -i 2000-10000 -n 1)
# Write the current Shiny matrix port number to file in
# ~/chepec/chetex/sample-matrix/shinyapp/shiny.port
echo $PORT > /home/taha/chepec/chetex/sample-matrix/shinyapp/shiny.port
# Save PID of this bash job
#echo $$ > /home/taha/chepec/chetex/sample-matrix/shinyapp/shiny.pid
# do iy inside Shiny itself with "reactive values" instead
# Run R Shiny app at localhost port
# Note: this process does not return control to bash...
R -e "shiny::runApp('~/chepec/chetex/sample-matrix/shinyapp', port = $PORT)"
Loading…
Cancel
Save