|
-
October 11th, 2012, 11:39 PM
#2
Re: Executing a child process in "C"
I have made the same script in bash,
If iwas to execute this script as a child process I would do something like
I wish to achieve a similar this in "C"
I know this may be simple for the experts, I have self taught myself by looking a source codes and figuring stuff out.
if file "/Stuff/s" exists then continue to run, if file "/Stuff/t" exists, then "mkdir /Stuff/test" if file "/Stuff/t" does not exists, then "rmdir /Stuff/test"
if file "/Stuff/s" does not exist then print or echo "quit" and then quit.
Code:
#! /bin/bash
function controlxmmscheck {
if [ -s /Stuff/s ]; then
xmmscheck
else
echo "quit controlxmmscheck"
fi
}
function controldiversion {
if [ -s /Stuff/s ]; then
diversion
else
rm /Stuff/t
echo "quit controldiversion"
fi
}
function xmmscheck {
# xmmscheck1
# Check if /stream1/t exists
if [ -s /Stuff/t ]; then
mkdir /Stuff/test
# Switch to diversion function
controldiversion
# Or else wait for 5 seconds
else
sleep 5
# Start this File all over again
controlxmmscheck
fi
}
function diversion {
# diversion
# check if file /stream1/t exists
if [ -s /Stuff/t ]; then
# Then wait for 5 Seconds
sleep 5
# Start this function again
controldiversion
else
rmdir /Stuff/test
# Switch to xmmscheck function
controlxmmscheck
fi
}
controlxmmscheck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|