ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I can't answer your question, but why do you do it that
way to begin with?
Just set-up a system user account with a login that's
disabled for ordinary logins; give him a password-less
login on the target machines (via public keypairs) and
do the job in a bash script ... no need to store passwords
in a flat-file.
Code:
for i in host1 host2 host3 host4 host5
do
scp file $i:/path/to/target
done
Thx 4 ur replay....and I am appreciate ur sudgetion, but I can not use shell scripting in my software so, If u have any other solution of my C program then plz replay me.
What control are you talking about? Do you mean control of the terminal or are you saying the function doesn't return? Are you wanting the terminal to go back to the session leader? If so, you can't block SIGTTIO/SIGTTOU in the session leader because it will fail. It's safe to leave them unblocked ONLY in the session leader since it can revoke the terminal from anyone else without blocking or stopping. If you aren't talking about this, please specify.
ta0kira
wen u fork a process, then in parent u can wait for the child using wait() or waitpid() syscall.
In my given code I am waiting for the forked child (the child part in which i m execl the pseudo terminal "/bin/bash") but the child is not returning back and we control encounters the wait() syscall, it pauses and waits for infinite times (in short my prog pauses at this line, and not returning back for the next iteration)
This is the actual problem i m currently facing....
and ya, control doesnt returning means child process does not returning back in parent process.
so i can not get the exit status of child. If I got the exit status of child the problem is solved form me...
When the child process execs, it leaves the process group of the parent. To open a new controlling terminal it needs to be in its own session, so the problem is likely that the child process is no longer a child of the parent, so the parent can't waitpid it.
ta0kira
I think you are thinking of "session" in place of "group". For example, when you have a command line with piped output each part of the command line is a different process, but they are all in the same group. They can be put into and taken out of the foreground as a group. All of the processes the shell has control over are a session, which can consist of many groups. A process can't have a different session without using setsid (in one form or another,) but can be moved from group to group by its session leader. When a fork execs, it takes on its own group so that signals to the session leader don't go directly to it. The session leader can then link all of the piped commands together and give it a single process group so pausing/continuing/fg/etc. affect all of them at once.
ta0kira
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.