01-10-2012
Hi all,
The question is only WHY it fails after say 500 times.. During this time i found some references regarding fork: resource unavailable, but i dont think these will solve the problem that i face.
@ MIRNI: You could be right..But for every one cycle, the system call after it returns back, it ensures that it checks the exit status of the child, and frees up the resources it takes.
In the man page i see this statement like this..
As mentioned, system() ignores SIGINT and SIGQUIT. This may make programs that call it from a loop
uninterruptible, unless they take care themselves to check the exit status of the child. E.g.
while(something) {
int ret = system("foo");
if (WIFSIGNALED(ret) &&
(WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
break;
}
But i feel the above statement should now be same as popen. SO i think the issue should be with fork since both these utilities have it as common.
Supposedly as told in man page (and even i call it in loop), if the exit status was not fine, and after continuous calls it failed, if we find it in between, what action to take? instead of the "break" above, should i manually set the return status and clean something? I am not sure.
Please share your ideas now.
And i dont think the "\n"s added here impacts the functionality of the system (). Tested it.
Regards,
Binny.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have the following shell script to map a drive to a windows machine:
echo Enter password:
stty -echo
read passwd
stty echo
mount -t smbfs -ousername=myusername,password=$passwd //192.168.2.5/sharename /mnt/mountname
It works fine and the share mounts, but for some reason I get this... (4 Replies)
Discussion started by: Spetnik
4 Replies
2. BSD
Hello,
I have a small inquiry.
Sometimes, my good friend, Charlie Root, sends me security notifications that a possible breakin attempt has occured. It looks like this:
Oct 29 06:58:17 cigva sshd: reverse mapping checking getaddrinfo for 180.144.164.220.broad.sm.yn.dynamic.163data.com.cn ... (2 Replies)
Discussion started by: brightstorm
2 Replies
3. Shell Programming and Scripting
Hello everybody,
I have a requirement in my script..
When i'am executing a script, it'll ask a passwd of some service account.. I need to pass it to the script through a zipped file when it asks for it.
The script can be executed by more people many number times. So for securty purpose, it... (1 Reply)
Discussion started by: raghu.iv85
1 Replies
4. Shell Programming and Scripting
Hi Guys,
Even though, i have called db2 sql file earlier, this is my first time to call a oracle sql file.
I need to make a database(oracle) connection and then call the sql file in a loop.
Can you please help me out.
Thanks for your help and time.
Regards,
Magesh (4 Replies)
Discussion started by: mac4rfree
4 Replies
5. Programming
Hi gurus can you explain following lines of code ?
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void)
{
pid_t pid;
int rv;
switch(pid = fork()) {
case -1:
... (7 Replies)
Discussion started by: wakatana
7 Replies
6. UNIX Desktop Questions & Answers
hey,
how do i create a for loop that runs for i from 001 to 500 ?
i need that the zero prefix will remain so when i print "i" it will
look like so:
001
002
.
.
008
009
.
.
058
059
.
.
500
please advise. (2 Replies)
Discussion started by: boaz733
2 Replies
7. UNIX for Dummies Questions & Answers
We have a program source C and is required to indicate how many times each function is called from the C program. also print the line number where there is a call.
I've tried something like this:
#!/bin/sh
for i in $*;do
if !
then
echo $i is not a C file.
else echo $i... (0 Replies)
Discussion started by: oana06
0 Replies
8. Shell Programming and Scripting
Hi,
I want to read file multiple times. Right now i am using while loop but that is not working.
ex.
While read line
do
while read line2
do
echo stmt1
#processing some data based on data.,
done < file2.txt
done < file1.txt # This will have 10... (4 Replies)
Discussion started by: tmalik79
4 Replies
9. Shell Programming and Scripting
I've created a tag in the makefile:
mytag: $(shell ${PWD}/script.sh)
When i do: make clean - the script is executed
When i perform make or make mytag the script is again executed with the output:
make: Nothing to be done for mytag
What i want ?
I want script.sh to be executed only... (0 Replies)
Discussion started by: Pufo
0 Replies
10. Shell Programming and Scripting
Hello,
I have this awk code in a bash script to perform a find and replace task. This finds one unique line in a file and substitutes the found line with a replacement.
#! /bin/bash
# value determined elsewhere
total_outputs_p1=100
# file being modified... (5 Replies)
Discussion started by: LMHmedchem
5 Replies