Programming :: Waiting For Multiple Childs - C - Waitpid?
Feb 28, 2011I would like to fork more children and then write their return values: so far I tried:
Code:
#include <stdio.h>
#include <stdlib.h>
[code]....
I would like to fork more children and then write their return values: so far I tried:
Code:
#include <stdio.h>
#include <stdlib.h>
[code]....
kpackagekit keeps waiting forever "Waiting for service to start".what is this service that it is waiting for? i am running fedora 12
View 1 Replies View RelatedI have a C program that may finish in seconds or weeks depending on the data. For the longer jobs I want to be able to press a key and get an intermediate result printed.
View 14 Replies View RelatedI have a script in which I need to wait until the required files are formed. Like the files are of the form a-1, a-2, a-3 and so on. I need to wait using sleep until files named a-1 to a-n are formed and value of n is known. How can I do this..?
View 5 Replies View Relatedi've written a socket server. when i launch a client, it connects to servers running on various machines on my local network, which then reply to the client with some string messages, and the client exits.
however, when i launch the client repeatedly (say 5 or 6 times in quick succession) the client is unable to bind to its local port. this appears to be because servers are still trying to connect to the client machine's port, even though the client exited and shut the socket down. the actual error i receive is "Error binding socket to 192.168.1.6:44561: Address already in use".
so, is it enough just to shutdown and close a socket? is there some way that in doing so the client machine can send a CONNECTION_REFUSED message to any machine trying to connect to it? i am using PHP, not that that should make much of a difference i hope.
the problem resolves itself after around 20 seconds as the machines trying to connect to the client timeout. i still need to fix this issue though.
I have a Python script that copies a couple of DLL's and EXE to a directory before running the EXE. It can be a fresh copy or the files can already be in the target directory and are then overwritten. The script uses shutil.copy() to copy the files and that works but as the files are copying processing continues and the script tries to run the files mid copy, causing an error.
I need a way to wait for the files to finish copying before the script continues. Putting the thread to sleep isn't good enough, calling os.system("copy ...") also doesn't work, using os.path.exist() won't work because the file will exist during the copy.
How can only directories be listed, that do not have another child directory?
Imagine a structure like /A /A/AA /A/AB /A/AB/ABB /B /C /C/CC /C/CC/CCC /C/CC/CCC/CCCC I would like to use find to list only /A/AA /A/AB/ABB /B /C/CC/CCC/CCCC.
The starting point would be find . -type d, but neither -mindepth nor -maxdepth can be used, can -noleaf help (I could not get it to react the way I wanted it to)?
I've browsed the internet, but haven't found a satisfying answer. Hope this forum can help me in the right direction.I'm exploring the possibilities of creating a program that manipulates (writes to) two different video cards.I program in C and hope to avoid high level libraries like Xlib to keep the mem footprint as low and the performance as high as possible. Windowing is not important no desktop environment will be used. Be able to write two pixels (one to each screen) to would do.
How would I go about?To give an idea of the solution I'm looking for:One screen will show thumbnails of images on the hard drive. Clicking an thumbnail on display A will show the selection full screen on display B. On a laptop; preferably thumbnails on the laptop screen and the selected image on the external monitor.Is this possible with just low-level libs or do I need X or some third-party software to make life easy?
I use a mencoder line to convert .avi to .mpg (dvd player compatible), it works well but i can only do one file at the time. It requires giving the input and output directories and the files name. I tried using (*.avi *.mpg in the command) on the directory but it just add up all the .avi and convert them into one huge .mpg. My goal is to have a script that would convert all the .avi files from a directory to the same amount of .mpg and also keep the naming of those files. Here is what i work with on single files:
Code:
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup
-srate 48000 -af lavcresample=48000
-lavcopts
[code]....
(i) I usually make multiple dir using -p optionex: mkdir -p dicttest/audrep/tdriver/testNow after creating this dir's i stay in current dir instead i want to go directly to test dir how can i acheive this.(ii) When i execute which command as followswhich testerm i will get the location of testterm now i want to open this filewhen i did in this wayhich testterm | vi The file dosent get opened how can i acheive this ?ex:
linuxx86:110$ which testterm
/view/rdl110_linuxx86/vobs_usrrdl/sc/testterm
linuxx86:110$ which testterm| vi
[code]....
I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well
How can i redirect same content to each of the .txt files in the folder?
I have tried
Code: $ echo "hello" > *.txt
-bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt
-bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it
Code: #! /bin/bash
for file in *.txt
do
echo "Text that needs to be written" > $file
done
I have a folder with only 24 files named <number>.dat (i.e. 4.dat, 6.dat and so on) where <number> is between 0 and 256. Each file has just two columns of data and nothing else.
I'm trying to combine all the second columns ($2) together. I've been fiddling around with getline and so far have
awk '{ getline ln < "6.dat" ; print ln" "$2 }' 4.dat
which takes file 4.dat and adds $2 from 6.dat, but I want a single command to take each $2 from every file and add them to (for example) 4.dat (having $1 from 4.dat is no problem). A command that takes every file in the folder and grabs $2 and places them in a common file would be ideal. Frankly I can work around if you combine both columns from every file.
I'm trying to write a .sh script that allows me to run multiple other .sh scripts at once.
My problem occurs within a Variable:
I have set
S1 to S7 to be the name of the .sh
A="7"
B="S$A"
C="$S$A" <- and this is where my problem is
I want C to be the content of S7 till S1 but if I run this line it will of course look for the content of S and link it with the content of A.
How can I correct this?
Edit:
WHERE="/home/X/Y/"
SH=".sh";
A="7";
B="S$A";
C="$B";
[Code].....
It is possible to run multiple instances of a jar executable. Is it possible that only a single instance of the jar runs? Wrappers like JSmooth or Launch4J can be made to run as a single instance. But since there are no such wrappers for linux, I need a way to restrict the jar to a single instance. How to embed the jar file into an executable such it runs a single instance?
View 14 Replies View RelatedI want grep multiple files:
let abc.1.abc.2,abc.3,abc.4
I use grep <pattern> abc.* to read the files. But here grep read files in the order of 1,2,3,4 . I want to to grep the files in reverse order like 1st the abc.4 file will be read and abc.1 file will be last.
Is this possible ?
I have prepared a script which will login to each server and search for a keyword.
I want output on same machine from where m running script.
When i try to run command on any machine.. It works well.
w=$(grep -irH "keyword.com" /home/*/public_html/*);if [ $? -eq 0 ];then echo -e "
$HOSTNAME";echo $(grep -irH "keyword.com" /home/*/public_html/* | cut -d: -f1 | uniq | awk '{for (i=1;i<=NF;i++) printf "%s
",$i}');fi
[Code]....
I have the following header file in /usr/include/test.h:
Code:
#ifndef TEST_H
#define TEST_H
const int test_version = 1;
#endif
[Code].....
how i could compile for example: a tutorial file of cantera open source files. when i do :g++ example.cpp -o examplei get huge errors such as the header files are not here,...please tell me how i could compile it. ofcourse i have configured the full opensources and i see in /usr/local/cantera/binthat the files are there but i still can not compile and execute any cpp file.
View 2 Replies View RelatedI am trying to implement a corba program (client) to retrieve customerinformation from the server. Since the server allow to login once andperform your operations until the lifetime experies, i want the client to use already login connection to perform the retrieve function withoutlogin in to the server for every request.Suppose retrieve has three functions, logon(), perform() and logoff()Pseudo code;Quote:
1. User runs a client application
./retrieve <URI> <customerID>
2. if the client program has already login, donot login, go to 4
[code]....
Code:
void* thread(void* arg)
{
[code]....
For example I want my Qt Creator app to have multiple custom dialogs. How do I manage them? Also, what if I want to replace all the widgets in a window with new ones, how do I manage that in Qt Designer?
View 4 Replies View RelatedI want to be able to use multiple options at the same time and some of those options will require an argument and some will not.
Here is my bash script:
#!/bin/bash
while getopts ":a:bc:de:fg:" opt ; do
case $opt in
a)
[Code]....
If I only use option -a with no arguments, the script works...
i need a script that will give as much system info such as CPU usage, partition info, mem usage, etc.. from multiple OS's, FreeBSD, AIX, HP-UX. I only know SCO unix and dont know the commands on the other OS's.
View 2 Replies View RelatedI want to create a script to insert the fstab and hostname in a textfile of multiple servers on the network without a password. The servers are situated in a text file. So i want to read the text file line by line and write the output into another textfile.
View 10 Replies View RelatedI am using SQLite as my database for some portable cross platform applications I am working on with REALBasic as my IDE. I have an old Sybase 8.0 database that I can access via Microsoft Access and thereby extract the data I need from each table.
Now I know I can create .csv files from each table and load them into SQLite using the import tool, but then I can't define the primary key and other field attributes. So the other option is to load each file via SQL.
Now with most SQL editors I can create multiple queries and they will run just fine. But I can't seem to do that with the SQLite interfaces. I can paste multiple queries but I can only run one at a time. And by that I mean I have to click run.
Ummm that's not acceptable since my biggest table contains over 600,000 records. I have the queries all written, that was easy using a simple interface I wrote in Access.
Code:
INSERT INTO tblMeters(recordId,meterId,meterName,meterSerNum,registerSerNum,mxuSerNum,meterType,manufacture,meterModel,readType,groupId,multiplier,rollover,vendorId,xfrmerCode,bldgCode,CATEGORY,energyType,unitOfMeasure,location,access,comments,dateInstalled,dateCalibrate,pipeSizeIn,pipeSizeOut,elecMeterSpecs)
[Code]...
So is there another method I can use? I can't seem to find anything relating to my particular question at the SQLite web site
I've got about twenty folders with names such as "Bennett Galleries" or "Athletic House" and I want to rename them to "Bennett_Galleries" or "Athletic_House". Any right utility to use to accomplish this (sed, awk, bash script, etc...)?
View 2 Replies View RelatedI'm trying to build a custom setup that requires a flash drive and a CD to both be mounted to root. Applications, boot data, and other static directories are on the CD, while /home, /opt, and /tmp are on the flash drive. Is there a special option I can enter into fstab to allow this? If not, I intend to modify my kernel to allow this, but I'll need to find the sources that control this function.
View 4 Replies View RelatedMy query is i have a.sql , b.sql , c.sql files which needs to be executed using "$ db2 -tvf a.sql"; "$ db2 -tvf b.sql"; "$db2 -tvf c.sql" , script with which i can execute all these sql files in a single shot.
View 4 Replies View RelatedI am running a script that can run as many as 10 simultaneous times. During my testing, i noticed that if the script starts while another is in process, it inherits the $1 variable, which is always different.For example, the script starts with "scripthere.sh entry1", anther one starts almsot at the same time "scripthere.sh entry2". As the script is running, the second instance inherits $1 from the first script. So instead of $1 entry2, it shows up as entry1. how I can store $1 so that its unique to that instance of the script only?
View 2 Replies View RelatedI have a variable in which the data is stored as below:
variable_test=0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s .....an so on.
There are lots of values in format like "3m1.057s" are stored in variable_test separated with an space between two such values. For exapmple, value is "3m1.057s" I need to save different parts of a value in three separate array variables such as the
var_hour=3
var_min=1
var_sec= 057
tell if this can be done using "awk". A "WHILE" loop might be used to separate and store theses values I guess?