Operating System - HP-UX
1754368 Members
4565 Online
108813 Solutions
New Discussion юеВ

executing c prog. with bash script

 
Oren_3
Occasional Contributor

executing c prog. with bash script

hi, everyone.
i wrote a bash script which works alot like "devil" - it is supposed to stay always "up" and search processes in the system.
if they arent up, it will execute them with nohup command.
so, what is the problem?
the scripts (written in bash) need to execute a csh based scripts which in turn, executes the c-program.
the whole process works fine, until after a few days, for some reason, the main bash script runs the csh script but the csh script cant execute the c program...
i know the csh scripts runs because i can see it log files running but i see no evidence that the c-prog ran.
i tryed to use rehash and clear the process memory table in the bash script, but it didnt work.
can anyone suggest any ideas?

thanks...
Oren.
3 REPLIES 3
Oren_3
Occasional Contributor

Re: executing c prog. with bash script

forgot to mention, i am using a hpux-11i system on a n class machine...
A. Clay Stephenson
Acclaimed Contributor

Re: executing c prog. with bash script

This seems like an overly complex scheme; I would probably do all of this within a C program that has been properly daemonized and make any script calls via the c system() or popen() functions. In any event, I would certainly avoid the csh. However, the key to finding your problem is to echo $status to your logfile (the equivalent of $? is bash) IMMEDIATELY after the csh script invokes the C program. A non-zero value (if the C program follows normal conventions) will indicate an error and the convention is that that value is errno.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: executing c prog. with bash script

The other kinds of problems to look for: Does the C program run when stdin, stdout, and stdin are not terminal devices? Does the C program create some sort of lock file, semaphore, or shared memory segment to keep more than one copy of itself running?
If it ain't broke, I can fix that.