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

  • Home
  • SEARCH
  • 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 8215545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:49:36+00:00 2026-06-07T11:49:36+00:00

I am using following shell script to launch a java daemon process (the command

  • 0

I am using following shell script to launch a java daemon process (the command is launched via root user):

 #!/bin/sh
 sudo -u postfix CONFIG_LOCATION=/mnt/custom java -Dcom.sun.management.jmxremote.port=10020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.config.file=${PresentWorkingDirectory}/logging.properties -cp "${ExecutableJar}:${PresentWorkingDirectory}${ClassPath}" com.x.y.filter <&- 1>/dev/null 2>&1 &

this is resulting in launching of the two running processes and I am seeing following records in the ‘ps -f -All’ output:

4 S root     24250     1  0  82   0 - 26247 -      20:33 pts/1    00:00:00 sudo -u postfix CONFIG_LOCATION=/mnt/custom java -Dcom.sun.management.jmxremote.port=10020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.config.file=${PresentWorkingDirectory}/logging.properties -cp "${ExecutableJar}:${PresentWorkingDirectory}${ClassPath}" com.x.y.filter <&- 1>/dev/null 2>&1 &
4 S postfix  24252 24250 47  82   0 - 364460 184466 20:33 pts/1   00:00:31 java -Dcom.sun.management.jmxremote.port=10020 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.config.file=${PresentWorkingDirectory}/logging.properties -cp "${ExecutableJar}:${PresentWorkingDirectory}${ClassPath}" com.x.y.filter <&- 1>/dev/null 2>&1 &

I am unable to understand why two processes are launched?

while I intend to run only one process and my shell script too is launching only one process.

Can somebody please explain the above observation?

What needs to be done to correct this?

  • 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-06-07T11:49:38+00:00Added an answer on June 7, 2026 at 11:49 am

    This is expected behaviour. You are calling sudo, which is a process. This process will change it’s user to postfix, then call java – another process.

    If sudo used exec (so that there was only one process used for that command), then java would be able to run things it shouldn’t (because the java binary would replace the sudo one in memory, and so have all the privileges the sudo one has), which would probably be a bad idea.

    Note that the sudo binary won’t be doing anything: it’ll just be waiting for java to terminate before doing it’s own cleanups.

    One of the key things to understand is that sudo is not a magic system utility, it’s just a normal application that as a setuid bit. This means, the sudo binary is allowed to change it’s runtime user-uid. Once you see this, you begin to understand how sudo works and why you get two processes.

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

Sidebar

Related Questions

I am using the following awk statement in my shell script. #!/bin/sh # read
I am trying to execute a simple git command using following python script. #!/usr/bin/python
I am using following command for start the production server. nohup ruby script/server webrick
I tried to declare a Boolean variable in a shell script using the following
I have the following shell script that I've been using in previous versions of
Currently i'm using a shell script to do the following: cd myproject1/ ant cd
I was Able to Run shell Script using Cygwin in java. But Now I
How do I execute the following shell command using the Python subprocess module? echo
I have the following shell script code. Here if I'm using NR==$i in gawk
I am using the following code to call a batch file: dim shell set

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.