473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to know a executable has finished his task

Hi frnds,

I want to know is there a way by which we can know that a C++ executable has finished its job in shell script.

My task is as follows:

1.Shell script calls a executable

2.Executable executes and performs its job of generating some reports.

Now i want my shell script to detect this that is C++ executable has completed its job so that shell script can send the reports as attachement.

Please help me urgently on this
Jan 4 '08 #1
2 1992
arne
315 Expert 100+
Hi frnds,

I want to know is there a way by which we can know that a C++ executable has finished its job in shell script.

My task is as follows:

1.Shell script calls a executable

2.Executable executes and performs its job of generating some reports.

Now i want my shell script to detect this that is C++ executable has completed its job so that shell script can send the reports as attachement.

Please help me urgently on this
If the executable is not started in the background (or detaches itself from the shell or execves some other programs), the shell will not continue until the executable has returned. So, you should be able to simply do the mail transfer as the next command after the invocation of the executable.

Let me know if I missed the point here :)

arne
Jan 4 '08 #2
bykwzpz
13
I agree - unless the executable fails. You might consider using the return code to determine the success or failure of the process. Most processes in UNIX return zero (0) as success and I will continue assuming yours does too.

The shell script would look something like this:

Expand|Select|Wrap|Line Numbers
  1. your_c++_executable || {
  2.      error_handling_procedure
  3.      exit 1
  4.      }
  5.  
  6. procedure_to_get_ reports
  7.  
The ' || ' (or) is saying essentially: do the c++ process OR error out and exit. If the c++ process is successful (and returns 0), the shell would proceed to get reports. Hope this sheds additional light on the subject for you.
Jan 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
1
by: Ola Theander | last post by:
Dear subscribers I'm currently creating a small application that will run at the end of a web installation to configure a SQL Server. For this task I have a SQL batch file in the same format...
17
by: Filipe Martins | last post by:
Hello. I've read somewhere that the executable is smaller if we use a source file for each function! So, I tested this with gcc and it seams to confirm! What seams to happen is that if we call...
4
by: Caroline | last post by:
I'd like to launch an executable file from a web page. Basically, the user enters seven parameters and then clicks a button to generate a graph. The input is written to a file and then read by...
3
by: Gustavo L. Fabro | last post by:
Greetings! I'm testing VS 2005 Beta 2, and I've compiled a program that runs just fine on my computer (where VS is installed). I've tried to run this same program on another computer (after...
34
by: priyanka | last post by:
Hi, I was wondering if we could parse or do something in the executable( whose source language was C). How can I use some scripting language like perl/python to find out the information about...
1
by: Will Ware | last post by:
I am trying to freeze a static executable. I built a static Python executable this way: ./configure --disable-shared --prefix=/usr/local make make install Even that didn't give me a really...
0
by: lifeshortlivitup | last post by:
I'm working on a program that allows the user to in put a task, click add task button, and then the task displays in a list box and disappears from the text box. I have completed all of...
4
by: Perl Beginner | last post by:
i have created an automation program using Perl (Win32). i converted the perl script to an executable file. what i would like to do is have a way for the user to easily kill the executable file if...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.