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 8346251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:57:02+00:00 2026-06-09T06:57:02+00:00

I have a simple shell script whose also is below: #!/usr/bin/sh echo starting the

  • 0

I have a simple shell script whose also is below:

#!/usr/bin/sh

echo "starting the process which is a c++ process which does some database action for around 30 minutes"
#this below process should be run in the background
<binary name> <arg1> <arg2>

exit

Now what I want is to monitor and display the status information of the process.
I don’t want to go deep into its functionality. Since I know that the process will complete in 30 minutes, I want to show to the user that 3.3% is completed for every 1 min and also check whether the process is running in the background and finally if the process is completed I want to display that it is completed.

could anybody please help me?

  • 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-09T06:57:04+00:00Added an answer on June 9, 2026 at 6:57 am

    The best thing you could do is to put some kind of instrumentation in your application,
    and let it report the actual progress in terms of work items processed / total amount of work.

    Failing that, you can indeed refer to the time that the thing has been running.

    Here’s a sample of what I’ve used in the past. Works in ksh93 and bash.

    #! /bin/ksh
    set -u
    prog_under_test="sleep"
    args_for_prog=30
    
    max=30 interval=1 n=0
    
    main() {
        ($prog_under_test $args_for_prog) & pid=$! t0=$SECONDS
    
        while is_running $pid; do
            sleep $interval
            (( delta_t = SECONDS-t0 ))
            (( percent=100*delta_t/max ))
            report_progress $percent
        done
        echo
    }
    
    is_running() { (kill -0 ${1:?is_running: missing process ID}) 2>& -; }
    
    function report_progress { typeset percent=$1
        printf "\r%5.1f %% complete (est.)  " $(( percent ))
    }
    
    main
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have a simple shell script or c program to generate random files
I have written a simple shell script to do some automation work. Basically the
I have a simple script named example : #!/bin/sh echo $'${1}' Please note that
A really simple shell script question. I have a file with something like this:
I have implemented a simple linux shell in c. Now, I am adding some
I am trying a simple shell script like the following: #!/bin/bash up_cap=$( cat result.txt
I have the following simple shell script: # get all servers from config sshservers=`node
I have a simple command in a Linux shell script (say foo.sh). In it
I have a simple shell script that builds my Roxygen documents, builds the package,
I have a simple shell script on my Ubuntu guest OS (running via VirtualBox):

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.