Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6120653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:41:35+00:00 2026-05-23T15:41:35+00:00

I have a shell script that calls a java jar file and runs an

  • 0

I have a shell script that calls a java jar file and runs an application. There’s no way around this, so I have to work with what I have.

When you execute this shell script, it outputs the application status and just sits there (pretty much a console); so when something happens to the program it updates the screen. This is like with any normal non daemonized/backgrounded process. Only way to get out of it is ctrl-c, which then ends the process altogether. I do know that I could get around this by doing path_to_shell_script/script.sh &, which would background it for my session (I could use nohup if I wanted to logout).

My issue is, I just don’t know how to put this script into a init script. I have most of the init script written, but when I try to daemonize it, it doesn’t work. I’ve almost got it working, however, when i run the initscript, it actually spans the same “console” on the script, and just sits there until i hit ctrl-c. Here’s the line in question:

daemon ${basedir}/$prog && success || failure

The problem is that I can’t background just the daemon ${basedir}/$prog part and I think that’s where I’m running into the issue. Has anyone been successful at creating an init script FOR a shell script? Also this shell script is not daemonizable (you can background it, but the underlying program does not support a daemonize option, or else I would have just let the application do all the work).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:41:36+00:00Added an answer on May 23, 2026 at 3:41 pm

    You need to open a subshell to execute it. It also help to redirect its output to a file, or at least /dev/null.

    Something like:

    #!/bin/bash
    ( 
      { daemon ${basedir}/$prog && success || failure ; } &>/dev/null
    ) &
    exit 0
    

    It work as follows ( list ) & in a background subshell. { list } is a group command, it’s used here to capture all the output of your commands and send it to /dev/null.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a shell script that starts tomcat using 'catalina.sh start'. This script runs
I have a shell script that runs some acceptance tests for an application I'm
I have a Windows shell script that opens an application. I'd like to modify
I have a DOS batch script that invokes a java application which interacts with
I have a C shell script that calls two C programs - one after
I have a Java console application that is launched from a batch script in
I have a shell script that executes a number of commands. How do I
I have a bash shell script that loops through all child directories (but not
I have a python script that has to launch a shell command for every
I have a complex command that I'd like to make a shell/bash script of.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.