Streama: Sorry for the ignorance on the subject rs. but can someone tell me how to set it to run without the command (java -jar streama-X.Y.jar) in putty? When I close the putty he falls,

Created on 22 Sep 2019  路  10Comments  路  Source: streamaserver/streama

--------------------------------------------------------------------------------------------------------

Thanks for reporting an issue for Streama, please review the instructions below before submitting the
issue.

YOUR ISSUE WILL BE CLOSED IF IT DOES NOT USE THIS TEMPLATE OR IT IS INCOMPLETE!

Feature requests can be done without this template.
If you have multiple things to report please create one issue per item.
Please use english when reporting issues.

If you are unsure about something and the issue is more of a question a better
place to ask questions is on discord.
DO NOT use the issue tracker to ask questions.

Please fill out the sections below the header and review the task list below.
Task List:

  • [ ] Issue description provided
  • [ ] Steps to reproduce provided
  • [ ] Stacktrace (if present) provided
  • [ ] Screenshots (if UI related) provided
  • [ ] Full description of the issue provided

PLEASE REMOVE THE ABOVE SECTION BEFORE SUBMISSION


Issue description

Steps to Reproduce

  1. TODO
  2. TODO
  3. TODO

Expected Behaviour

Tell us what should happen

Actual Behaviour

Tell us what happens instead

Environment Information

  • Operating System: TODO
  • Streama version: TODO
  • Custom streama build, describe customizations or provide link to fork (If Applicable): TODO
  • Container Version (If Applicable): TODO
Discussion

Most helpful comment

It's a little more involved, but a better way to do this is to create a service definition file. In doing this, you can have the server start up automatically in addition to running in the background. It should be doable on any recent Ubuntu installation.

This assumes you created a user named _streama_ and that the application is installed in directory _/srv/streama_. It also assumes StreamA 1.7.3 is installed. If any of these are different in your installation, update accordingly below.

As the _root_ user, create the file /etc/systemd/system/streamaserver.service with the following contents:

[Unit]
Description=StreamA Video Server
After=network.target

[Service]
Type=simple
WorkingDirectory=/srv/streama
User=streama
ExecStart=/usr/bin/java -jar /srv/streama/streama-1.7.3.jar
Restart=on-failure

[Install]
WantedBy=multi-user.target

After you save the file, run the following commands (sudo isn't needed if you are already running as root):

sudo systemctl daemon-reload
sudo systemctl enable streamaserver.service
sudo systemctl start streamaserver.service

If you log out, the service will remain running. Additionally, it should restart automatically when you restart the system. If you ever need to update any of the items in the service definition, you can run the command:

sudo systemctl edit --full streamaserver.service

All 10 comments

See screen: https://linux.die.net/man/1/screen

Further instructions could have been provided if you had completed the information in the debug template.

you could always run with

nohup java -jar streama-1.7.3.jar &

that will run the process in the background and then you can close putty

maybe use a software named "screen"
hope it can help

maybe use a software named "screen"
hope it can help

I said that a month ago.

@stom66
oh ididn't see it
too carelessly (^锝ワ姜锝)

It's a little more involved, but a better way to do this is to create a service definition file. In doing this, you can have the server start up automatically in addition to running in the background. It should be doable on any recent Ubuntu installation.

This assumes you created a user named _streama_ and that the application is installed in directory _/srv/streama_. It also assumes StreamA 1.7.3 is installed. If any of these are different in your installation, update accordingly below.

As the _root_ user, create the file /etc/systemd/system/streamaserver.service with the following contents:

[Unit]
Description=StreamA Video Server
After=network.target

[Service]
Type=simple
WorkingDirectory=/srv/streama
User=streama
ExecStart=/usr/bin/java -jar /srv/streama/streama-1.7.3.jar
Restart=on-failure

[Install]
WantedBy=multi-user.target

After you save the file, run the following commands (sudo isn't needed if you are already running as root):

sudo systemctl daemon-reload
sudo systemctl enable streamaserver.service
sudo systemctl start streamaserver.service

If you log out, the service will remain running. Additionally, it should restart automatically when you restart the system. If you ever need to update any of the items in the service definition, you can run the command:

sudo systemctl edit --full streamaserver.service

Great tip, thanks @ejstage. Is it possible to view the streama console output when running it as a service, or to log the output to a file?

Yes. Systemd logs any units' output for you automatically. You can view it with journalctl, for the suggested unit file it'd be

# journalctl --unit streamaserver.service

Also check out journalctls' man page should you need more options.

Sure. Using the above setup, you can view what the application wrote to the console using the following command:
journalctl -u serveaserver.service

I think you can have it write to the system log (/var/log/messages) if, in the service definition, you add:

StandardOutput=syslog
SyslogIdentifier=serveaserver

I haven't done the latter, though, in practice, since most of the applications I've worked with usually writes its own logs.

In addition to creating a service like @ejstage mentions, I like to have a symlink called _streama-latest.jar_ pointing the latest version. In the directory where streama is installed just run:

ln -s streama-1.7.3.jar streama-latest.jar

This way you don't have to edit your _.service_ file every time you change version, just recreate the symlink and restart the service.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ircas picture Ircas  路  3Comments

willmtemple picture willmtemple  路  6Comments

Shrinks99 picture Shrinks99  路  6Comments

airsay picture airsay  路  4Comments

mongomay69 picture mongomay69  路  7Comments