473,396 Members | 2,030 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,396 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 2000
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.