Unknown job: shiny-server

1,385 views
Skip to first unread message

Raphael Nguyen

unread,
Dec 1, 2014, 3:11:31 PM12/1/14
to shiny-...@googlegroups.com
Hi all, I've managed to successfully install R, Shiny, and Shiny Server on my Linux Mint 17.1 box following this guide: http://rstudio.github.io/shiny-server/latest/

Even though the installation was successful, I am unable to use the command: sudo start shiny-server. It fails with the error message Unknown job: shiny-server. Can anyone help troubleshoot why my installation is unable to run the shiny-server command? Perhaps there are additional configuration steps that I may be missing. Please advise.

Fereshteh Karimeddini

unread,
Dec 2, 2014, 12:13:48 PM12/2/14
to shiny-...@googlegroups.com
Hi Raphael,

Did you just install the ".deb" package?

Could you run the following 2 commands to see which file exists:

ls -al /etc/init/shiny-server.conf

OR

ls -al /etc/init.d/shiny-server


Fereshteh

Raphael Nguyen

unread,
Dec 2, 2014, 12:24:44 PM12/2/14
to shiny-...@googlegroups.com
Hi Fereshteh,

Following the guide, I installed r-base and r-base-dev first. Next, I installed the Shiny R package:

sudo su - -c "R -e \"install.packages('shiny',repos='http://cran.rstudio.com/')\""

I then installed the .deb package for shiny server using:

sudo apt-get install gdebi-core
wget http://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.2.3.368-amd64.deb
sudo gdebi shiny-server-1.2.3.368-amd64.deb

Running the two commands that you have listed, it seems as if both shiny-server.conf and shiny-server exists in /etc/init and /etc/init.d respectively.

Fereshteh Karimeddini

unread,
Dec 2, 2014, 2:31:46 PM12/2/14
to shiny-...@googlegroups.com
There could be some incompatibility between Upstart module on Mint and other flavors of Linux. We do not officially support Mint, but it is very possible that you could get it running. Can you try this command:

 sudo /usr/bin/shiny-server --pidfile=/var/run/shiny-server.pid

If this runs without error, then your Shiny Server has started. You can test it by accessing http://localhost:3838/sample-apps/hello/


Fereshteh

Raphael Nguyen

unread,
Dec 2, 2014, 3:57:10 PM12/2/14
to shiny-...@googlegroups.com
It's alive!

That command worked perfectly and my Shiny Server is now up and running. I'd like to continue to troubleshoot why it wouldn't run initially if you don't mind. Does any thought cross your mind as to why it would work with this:

sudo /usr/bin/shiny-server --pidfile=/var/run/shiny-server.pid

but not with:

sudo start shiny-server

I'm afraid that not being able to run Shiny Server using the latter syntax might lead to additional problems in the future. Please share your thoughts.

Fereshteh Karimeddini

unread,
Dec 2, 2014, 4:36:15 PM12/2/14
to shiny-...@googlegroups.com
Shiny Server installation creates a job in /etc/init/shiny-server.conf. Upstart recognizes this job, and "sudo start shiny-server" command starts the job/process. But in your case Upstart doesn't recognize this job, which could be due to a syntax error (possible differences between Ubuntu and Mint). Can you try running this command:

 init-checkconf /etc/init/shiny-server.conf

Raphael Nguyen

unread,
Dec 2, 2014, 4:39:28 PM12/2/14
to shiny-...@googlegroups.com
That command gave the following error:

~ $ init-checkconf /etc/init/shiny-server.conf
ERROR
: File /etc/init/shiny-server.conf: syntax invalid:
init
:shiny-server.conf:2: Unknown stanza

Fereshteh Karimeddini

unread,
Dec 2, 2014, 4:52:44 PM12/2/14
to shiny-...@googlegroups.com
What do you have as line 2 of that file?

You probably have something like this: env LANG='en_US.UTF-8'

In that case, try removing the line (or commenting it out), and retry.

Raphael Nguyen

unread,
Dec 2, 2014, 4:55:42 PM12/2/14
to shiny-...@googlegroups.com
Line 2 of that file is:

run_as shiny;

Here is the full file in question:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server
{
  listen
3838;


 
# Define a location at the base URL
  location
/ {


   
# Host the directory of Shiny Apps stored in this directory
    site_dir
/srv/shiny-server;


   
# Log all Shiny output to files in this directory
    log_dir
/var/log/shiny-server;


   
# When a user visits the base URL rather than a particular application,
   
# an index of the applications available in this directory will be shown.
    directory_index on
;
 
}
}

Is it possible that the user shiny has not been created and is thus throwing the error?

Fereshteh Karimeddini

unread,
Dec 2, 2014, 5:36:31 PM12/2/14
to shiny-...@googlegroups.com
This is the wrong file, and it is strange that it is there.

There are 2 different shiny-server.conf files on the system after Shiny Server is installed (notice the paths):

1- /etc/shiny-server/shiny-server.conf
2- /etc/init/shiny-server.conf

The file you pasted is #1. If the same file also exists as #2, then something has gone wrong during installation. 

But to fix the problem, do the following:

- Stop Shiny Server if it is running
- sudo rm /etc/init/shiny-server.conf
- sudo vi /etc/init/shiny-server.conf
- Add the following lines to the file:

# shiny-server.conf

description "Shiny application server"

start on runlevel [2345]
stop on runlevel [016]

limit nofile 1000000 1000000

post-stop exec sleep 5

exec shiny-server --pidfile=/var/run/shiny-server.pid >> /var/log/shiny-server.log 2>&1

respawn limit 3 25

respawn


- Start Shiny Server using this command:
sudo start shiny-server


Hope this fixes the problem.

Fereshteh

Raphael Nguyen

unread,
Dec 2, 2014, 5:49:28 PM12/2/14
to shiny-...@googlegroups.com
Fereshteh, you're the best! This did indeed fix the error. I really hope this is the only thing that went wrong during installation as I'm worried future problems may pop up, but thank you again for all of your help. :)

Fereshteh Karimeddini

unread,
Dec 3, 2014, 9:55:39 AM12/3/14
to shiny-...@googlegroups.com
Thanks Raphael. Glad that it is now working for you. And let us know if any issues pop up.

Fereshteh

Jeff Parke

unread,
May 12, 2015, 6:02:01 AM5/12/15
to shiny-...@googlegroups.com
Just to update - I hit the same problem on a fresh install of shiny-server on mint 17.1, and upstart won't work.

/etc/init/shiny-server.conf does not exist at the end of the install. After a quick glance at the documentation, I realised /etc/shiny-server/shiny-server.conf did exist, and copied it over. But even though they have the same name, these are two different files. shiny-server looks at /etc/shiny-server/shiny-server.conf when starting, and this file is correctly formatted, as evidenced by the ability to start the server on the command line.

Upstart looks at /etc/init/shiny-server.conf before starting it. Clearly, copying it over was the wrong thing to do, because upstart just complained it was improperly formated, it needed the fix documented above.

Thanks

Jeff.

Xandria Webb

unread,
May 20, 2015, 4:48:06 PM5/20/15
to shiny-...@googlegroups.com
Hi there!
I'm having the same issue on a redhat box, getting an error message when I type start shiny-server or stop, restart... etc. except the shiny-server.conf files are as you say they should be. I am able to get shiny server to start by typing the command shiny-server. If I do that in my putty window, then shiny-server will stop automatically whenever I close out of the server. But then I made a cron job to run that command, and now I cannot seem to get shiny-server to stop.
Any other suggestions, Fereshteh?
Thanks!
Xandria

Joe Cheng

unread,
May 20, 2015, 4:52:09 PM5/20/15
to Xandria Webb, shiny-...@googlegroups.com
"start shiny-server" is specific to Ubuntu (and other distros that use Upstart). The instructions for Red Hat are a bit different and depend on the version--what version of Red Hat are you on?

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/2712f3ef-367a-4d7b-bf89-79ba0fd90c27%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Xandria Webb

unread,
May 21, 2015, 10:54:12 AM5/21/15
to shiny-...@googlegroups.com, xandri...@datamininglab.com
Thanks, Joe. We are using Red Hat version 6.

Joe Cheng

unread,
May 21, 2015, 12:48:34 PM5/21/15
to Xandria Webb, shiny-...@googlegroups.com
I believe these are the instructions you want then:


If you already have rogue shiny-server processes running from your cron job, then stop them using "sudo pkill shiny-server" or "sudo killall shiny-server".

Xandria Webb

unread,
Jun 1, 2015, 12:43:57 PM6/1/15
to Joe Cheng, shiny-...@googlegroups.com
Thanks, Joe! That's exactly what I needed!
(Although the instructions at the link you sent don't seem to work on this red hat instance.)
--

Xandria F. Webb | Elder Research, Inc. | xandri...@datamininglab.com855-973-7673 ext. 705

2101 Wilson Boulevard Suite 900 | Arlington, VA 22201 |www.elderresearch.com

Joe Cheng

unread,
Jun 1, 2015, 12:45:31 PM6/1/15
to Xandria Webb, shiny-...@googlegroups.com
Oh, that doesn't work? What does "ps -p 1" output?

Xandria Webb

unread,
Jun 1, 2015, 12:49:30 PM6/1/15
to Joe Cheng, shiny-...@googlegroups.com
PID  TTY         TIME  CMD
  1     ?          00:00:02   init

is this what you'd expect?

Joe Cheng

unread,
Jun 1, 2015, 12:50:28 PM6/1/15
to Xandria Webb, shiny-...@googlegroups.com
Hmm, yeah. What happens when you try the commands at the link I sent?

Xandria Webb

unread,
Jun 1, 2015, 12:55:10 PM6/1/15
to Joe Cheng, shiny-...@googlegroups.com
I get the error:
shiny-server: unrecognized service

Brett Longworth

unread,
Mar 14, 2016, 1:19:08 PM3/14/16
to Shiny - Web Framework for R
I ran into this problem today when updating to version 1.4.2 of shiny server from v1.2.3 (I think) on Mint 17.1. I followed the install instructions on the rstudio page exactly.

sudo start shiny-server worked fine before the upgrade and gives the "Unknown job" error after. What's happening is that the installer removes /etc/init/shiny-server.conf. Recreating the file with the contents in Fereshteh's reply fixes the problem. Is this an installer bug? I know Mint isn't supported, but it seems like it would be an easy fix. 

Here's the output of the install command:

Preparing to unpack shiny-server-1.4.2.786-amd64.deb ...
Unpacking shiny-server (1.4.2.786) over (1.4.2.786) ...
Setting up shiny-server (1.4.2.786) ...
User shiny already exists. Ensuring proper permissions on /home/shiny/.
grep: /etc/init/shiny-server.conf: No such file or directory
Adding LANG to /etc/init.d/shiny-server, setting to en_US.UTF-8
 System start/stop links for /etc/init.d/shiny-server already exist.

On Tuesday, May 12, 2015 at 6:02:01 AM UTC-4, Jeff Parke wrote:

Joe Cheng

unread,
Mar 14, 2016, 2:51:18 PM3/14/16
to Brett Longworth, Shiny - Web Framework for R
What's the output of lsb_release --id --short from your terminal?

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

Joe Cheng

unread,
Mar 14, 2016, 2:51:45 PM3/14/16
to Brett Longworth, Shiny - Web Framework for R
n/m just saw your PR :) Thanks!

kashish soien

unread,
Jul 18, 2017, 10:46:20 AM7/18/17
to Shiny - Web Framework for R
Hi Fereshteh,

I am facing similar trouble in running shiny-apps. The following commands :

ls -al /etc/init/shiny-server.conf

OR

ls -al /etc/init.d/shiny-server

result in -"No such file or directory"

Can you please help in this regard?

Kashish

Patrick Gichini

unread,
Feb 16, 2018, 1:20:48 PM2/16/18
to Shiny - Web Framework for R
This was asked a long time ago but someone might probably come checking. In my case, shiny server had installed on /opt/shiny-server and the systemd service file was in there in a folder called systemd. I had to copy it and paste it in the normal system folder and then I ran sudo systemctl start shiny-server. Worked like a charm!
Reply all
Reply to author
Forward
0 new messages