I want to start e.g. my ElasticSearch instance which is installed manually via one-click in the cinnamon menu.

What I can do is /opt/elasticsearch-1.6.2/bin/elasticsearch & and the application is starting in the background. So I want the same behaviour by adding a menu item. But I cannot start this in background mode, only foreground seems to work.

Working (but only fg):

$ cat ~/.local/share/applications/elasticsearch-1.6.2.desktop [Desktop Entry] Version=1.6.2 Type=Application Name=ElasticSearch Icon=/opt/elasticsearch-1.6.2/bin/elasticsearch-icon.png Exec="/opt/elasticsearch-1.6.2/bin/elasticsearch" Comment=ElasticSearch 1.6.2 Categories=Development;Server; Terminal=true StartupWMClass=elasticsearch

Not working (trying to set an & in Exec at the end):

Exec="/opt/elasticsearch-1.6.2/bin/elasticsearch &"

Am I missing something?


You may want to try:

x-terminal-emulator -e /opt/elasticsearch-1.6.2/bin/elasticsearch &

That should use the default terminal (you can specify your preferred one if compatible), which usually supports -e (xterm, ROXterm, XFCE4-terminal). It works for me with alsamixer.

  • I tried this without success. A terminal window is opened and command was given as expected. But the ElasticSearch instance was destroyed after closing terminal. – colidyre Dec 6 '16 at 14:08
  • I didn't realise until I did a web-search what elastic search was. It appears to be a background process providing an API. Pretty sure there's a "correct calling convention" documented in the manual pages or site (something like /path/to/elasticsearch --daemonize) or a service provided for it. Still, glad you found a workable solution. – nonzyro Dec 6 '16 at 15:31

I don't know if it's the most sufficient answer. But this worked for me, finally:

  1. Create a shell script which start ElasticSearch via nohup

    #!/usr/bin/env sh
    # -*- coding: utf-8 -*-
    nohup /opt/elasticsearch-1.6.2/bin/elasticsearch 2> /dev/null &
  2. Move the shell script to /usr/local/bin (optional) and make it executable

    chmod +x elasticsearch && mv elasticsearch /usr/local/bin/
  3. Configure the desktop entry to call shell script

    [Desktop Entry]
    Comment=ElasticSearch 1.6.2

This approach needs nohup as an additional resource, but has the advantage that the outsourcing to shell script is a more general solution, maybe also suitable for other applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.