There are ways to do this from the daemon:
1. write to a known memory location in a given process - like a message queue or shared memory.
2. write to a named pipe or to a given filename
The is nothing you can do in shell by itself; you have to seriously rewrite the daemon.
Also event method is nice. daemon is trivial and not poll anything if both: daemon + client use signals = very hw friendly.
Daemon:
Daemon trap some signal ex. 2 in previous code.
Client create some own file like $$.mydata.ask:
Then send signal for daemon
Then daemon catch the signal 2 and read some directory.
There is NNN.mydata.ask files
Run those files in same process:
Then do the ...
And write answer to the file $MYANSWERFILE.tmp
and give the answer for client which poll this file
Ofcourse it's also possible that client create subprocess, give that PID number for daemon. Daemon send signal for that dummy process.
Child wait that process to end.
thanks for theses completes answers.
Of course, i can modify the c daemon program. (i am coding it)
for kshji solution, thanks for all the code. I can use it. Seems to be a bit heavy for the fs system (embedded system)?
For queue message, it seems to be a good ligth solution.
How can make a message queue between shell script and the process? And does the messages are length dynamic?
my initial idea, but doesn't know if it is possible:
From application make entrie in /proc fs : /proc/mapping
and make a virtual tree.
is it possible?
all call to a subfolder/subfile acess to the "only function"
My_function_openfile
1) I have two scripts named as a.sh,b.sh running two different hosts host1 and host2
2) So now how to execute b.sh on host2 from a.sh on host1
3) Also I have few queries regarding the same as I want to execute few commands with sudo and with different user in script b.sh so how this can be... (2 Replies)
My understanding of the gnus-demon is that it should run its handlers each gnus-demon timestep. I have my gnus demon timestep set to the default 60 seconds. I have registered one handler that prints something out every time it is called (and is supposed to update the group buffer). However, the... (0 Replies)
Hi all,
I have an assignment from school to write a shell program in linux. the idea is to exercise fork() and execv() functions.. the shell program is supposed to be the master and every command that the user prints will run in a new process. we also need to try running the command in every... (1 Reply)
If I open two bash shells and telnet from Shell 2 to a remote server (on the Net), is there a way to direct input from Shell 1 to the telnet shell?
The telnet shell is a limited environment with a specific command set.
I want to direct commands from Shell 1 and, if possible, put 1-second... (2 Replies)
Hello all
i need to implement demon that needs to extract data from db load the data to memory and according to this data
to perform actions like sending emails or write/update files this action needs to be preformed each 30 min's
now i really don't know what to decide or to compile c++... (5 Replies)
i want to write a C chat program that communicates over IPC(inter process communication), that could be run using 2 seperate terminal windows within the same computer. so that wat u type in one terminal window , should appear on the other and vice versa...
could some one please help me with the... (2 Replies)
Hi again,
I spoke with Keyspan and they assured me the USB to Serial device was working if I could use the Screen tool.
I asked why I was unable to redirect stdin/stdout to and from the /dev/tty. device and was told there was no reason I shouldn't be able to do so.
I have tried:
... (1 Reply)
I want to print the value of variables a1, a2, a3 in for loop in the following program:
a1=this
a2=is
a3=printed
for((i=1;i<4;i++))
do
var=a$i
#w=`echo $var`
e=${var}
echo $e
done
But actually I get a1,a2,a3 as the output not the "this is printed"
So the main question is if I... (3 Replies)
Hello
im kinda new to perl programming in unix
i need to make some kind of perl demon that sites and waits to see if there is files in the dir
if there is complete file ( not part of it ) , I need to mv it to different dir
ok so the easy parts to cp files and perl I know , but how the hell... (1 Reply)
Hi,
I have the following problem. I have 2 programs, a java program and a c++ program. These 2 programs have to communicate with each other in full duplex mode. I want to use pipes for this communication. So when the c++ program pust something on the stdout the java program must be able to read... (4 Replies)