How to check succeesfull finish of a executable from the sheel script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check succeesfull finish of a executable from the sheel script
# 1  
Old 01-03-2008
How to check succeesfull finish of a executable from the sheel script

Hi,

I want to know is there a way out wherein we can know that the C++ executable has finished its task.

Following is the steps:

1.Shell script calls a executable after setting all the env variables.

2.Now after the executable has done its job(basically to create some outpur files).The shell script needs to send out a mail with these output files as attachement.

Please help me in this asap.
# 2  
Old 01-03-2008
If you can be sure that there will only be one process with the name of the c++ program running at any one time use something like:

start the c++ program...

str=`ps aux |grep <c++ name>|grep -v grep`
while [ ! "$str" = "" ];
do
sleep 60 # wait 1 minute and try again
str=`ps aux |grep <c++ name>|grep -v grep`
done;

... now deal with the files.
# 3  
Old 01-03-2008
Sounds a bit complicated, from the original spec the following should work...

Code:
#!/bin/sh
run-c++-program
echo "done" | mailx -s "done" fred@bedrock

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finish current script and execute next script

Hi, I've come accross a situation where I need to exit from current shell script at the same time I need to start/activate another shell script. How can I do that in KSH ?? Need help !! For example, my script is as below #!/bin/ksh paramFile="/home/someXfile.lst" ] && <<Here I... (1 Reply)
Discussion started by: R0H0N
1 Replies

2. Shell Programming and Scripting

Who can finish this script?

Good morning dear friends, I want to write an UNIX script to do the following task: We have 6 directories, called (SMS_01, SMS_02 ....... SMS_06), some files are distributed across these directories, but the distribution process is not good, I mean when I check these directories I found the... (14 Replies)
Discussion started by: Mohannad
14 Replies

3. Solaris

How to check the Mirror progressing finish from ILOM?

Hi every one! I've just finish configuration LSI - created RAID 1 mirror from ILOM (Sparc T4-2) yesterday. However, when I check it today, I find: ok> show-volumes ... Mirroring... and the led of disks are not lighting. So, how do I confirm the progressing is finish or not? Thank... (1 Reply)
Discussion started by: trantuananh24hg
1 Replies

4. Shell Programming and Scripting

expect ssh script cannot finish and exit

All i am new to linux, and try to have a simple expect script to ssh then telnet to the network equipment, and exit itself. but dont know why i hang at the last $ #!/usr/bin/expect set timeout 10 set arg set arg1 spawn ssh -l UserA 1.1.1.1 expect "assword:"; send "PasSwOrD\r";... (1 Reply)
Discussion started by: samoptimus
1 Replies

5. Shell Programming and Scripting

Finish script help

I am trying to add a finish script that can copy hosts, static routes and a few other files into relevant directories on a client system. These files would be mounted as nfs resource on the client as hosts.hostname, static_route.hostname etc. Script will compare the hostname of the client and copy... (0 Replies)
Discussion started by: c0kazaz
0 Replies

6. UNIX for Dummies Questions & Answers

Jumpstart finish script (Solaris 10)

Hi there, I wanted to write a finish script for my jumpstart server which creates a ntp.conf file and enables ntp on the client machines during installation. Is that possible? Thanks for the help :) P.S. I'm a real Solaris noob, so do excuse me if I sound like an idiot..lol (1 Reply)
Discussion started by: iman453
1 Replies

7. Shell Programming and Scripting

Sheel script to Delete a set of files from a given directory

I have a file <filestodelete> containing names of files to to be deleted from a directory <filesstore>. I want a script file which accptes the <filestodelete> and also the location of the directory(<filestore>) and deletes all files matching. Thanks in Advance.. (3 Replies)
Discussion started by: VardhiniVenkat
3 Replies

8. Shell Programming and Scripting

Need a sheel script to compare no of file on diffrent servers

i have serverA and serverB and i have a folder with same name an location in both servers.... Now i want to compare files in folder(serverA) with folder (serverB) if there are files missing in folderB then copy those files from folder(serverA) to folder(serverB) (1 Reply)
Discussion started by: ashahzad
1 Replies

9. Shell Programming and Scripting

chaging a environment varible using sheel script

hi How can one change an environment varaible inside a shell script say my bash shell has a env variable export FOO="Day" no i want to write a script inside which the FOO variable is modified to say export FOO=NIGHT after this script finishes te bash shell should show me NIGHT when i... (1 Reply)
Discussion started by: wojtyla
1 Replies

10. HP-UX

Unix sheel script to run report

Hi All, I have a report which I am running from unix shell script using CONCSUB utility. Just for testing I put the order number in shell script as ord_low and ord_high. But Actually what is going to happen is that the order numbers will be in a file say a.txt and this CONCSUB should... (0 Replies)
Discussion started by: isingh786
0 Replies
Login or Register to Ask a Question