From: no.top.post on
I've got a nice system that run 'on top of' linux and which can
read/write linux files too. In order to still be able to see the other
system's display, instead of switching to linux when I 'run' some
simple linux commands I could perhaps eg.
1. write to a 'known special' file: "ls /usr/*"
2. which would, via some daeamon mechanism:
read the 'known special' file and execute
eg. "ls /usr/* > SpecialRetrnFile"
3. read/display "SpecialRetrnFile"

How could I implement the linux daemon mechanism ?
Or are their other more sophisticated but not too complex
methods of doing such client-server transactions?

== TIA.

PS. right now, I'm writing this with 'the other system'
which will "News.Send <theFile>"; but will use the linux ppp
to post the News.

PSS. I just did: 'top > /root/top'
But '/root/top' is accumulating instead of renewing ?!

From: Lew Pitcher on
On December 11, 2009 12:08, in alt.os.linux.slackware, no.top.post(a)gmail.com
wrote:

> I've got a nice system that run 'on top of' linux and which can
> read/write linux files too. In order to still be able to see the other
> system's display, instead of switching to linux when I 'run' some
> simple linux commands I could perhaps eg.
> 1. write to a 'known special' file: "ls /usr/*"
> 2. which would, via some daeamon mechanism:
> read the 'known special' file and execute
> eg. "ls /usr/* > SpecialRetrnFile"
> 3. read/display "SpecialRetrnFile"
>
> How could I implement the linux daemon mechanism ?
> Or are their other more sophisticated but not too complex
> methods of doing such client-server transactions?

Your requirements sound simple enough that you don't really need to go as
complex as a "daemon" process. FWIW, there /is/ a standard library function
called daemon(3) ("man 3 daemon") that takes care of all the activities
that a process must do to daemonize itself. /If/ you needed to daemonize
from a program's source, this would be the way to do it.

If your "nice system" can write to a Linux file, then your task is pretty
simple:
a) have the "nice system" write to a Linux file, and
b) on the linux side, run an xterm with a tail(1) command in "follow" mode.

For example, if the "nice system" writes /var/log/nice_system, then you
could, on the Linux side,
xterm -e tail -f /var/log/nice_system
to review the log as it is written.

If you don't want that log file to persist after you've reviewed it,
you /could/ create it as a FIFO (see mkfifo(1)), which is a data queue
managed entirely within the kernel. Note that the queue is fairly small (on
the order of a few Kbytes), and if it is not cleared, the /writer/ will
block until it is. This means that you /must/ read the file in order for
the "nice system" to continue writing to it; as soon as you stop, the "nice
system" will hang, awaiting the queue to clear.

> == TIA.
>
> PS. right now, I'm writing this with 'the other system'
> which will "News.Send <theFile>"; but will use the linux ppp
> to post the News.
>
> PSS. I just did: 'top > /root/top'
> But '/root/top' is accumulating instead of renewing ?!

Of course. top doesn't stop writing, and writes are accumulated. If you are
looking for an "over-write" facility from top, you'll have to change how
top manages it's output file. You /could/ use a FIFO, again, with the
caveat that the reader must read, or the writer hangs.

HTH
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------


From: Peter Chant on
no.top.post(a)gmail.com wrote:

> I've got a nice system that run 'on top of' linux and which can
> read/write linux files too. In order to still be able to see the other
> system's display, instead of switching to linux when I 'run' some
> simple linux commands I could perhaps eg.
> 1. write to a 'known special' file: "ls /usr/*"
> 2. which would, via some daeamon mechanism:
> read the 'known special' file and execute
> eg. "ls /usr/* > SpecialRetrnFile"
> 3. read/display "SpecialRetrnFile"

Sorry, I'm not quite clear what you are doing. Do you have two machines
with one running as a client and one a server?

Personally I'd not put data files in /usr/, if by "special files" you mean
programmes you have created how about putting them in /usr/local/bin?

>
> How could I implement the linux daemon mechanism ?
> Or are their other more sophisticated but not too complex
> methods of doing such client-server transactions?
>

Look up sockets for what ever language you are programming in.


--
http://www.petezilla.co.uk

From: Chris F.A. Johnson on
On 2009-12-11, no.top.post(a)gmail.com wrote:
....
> eg. "ls /usr/* > SpecialRetrnFile"

There is no good reason to use ls without any options; printf is a
builtin command in the major shells.

printf "%s\n" > SpecialRetrnFile


--
Chris F.A. Johnson, author | <http://cfajohnson.com>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
From: goarilla on
On Fri, 11 Dec 2009 17:08:31 +0000, no.top.post wrote:

> I've got a nice system that run 'on top of' linux and which can
> read/write linux files too. In order to still be able to see the other
> system's display, instead of switching to linux when I 'run' some simple
> linux commands I could perhaps eg. 1. write to a 'known special' file:
> "ls /usr/*" 2. which would, via some daeamon mechanism:
> read the 'known special' file and execute
> eg. "ls /usr/* > SpecialRetrnFile"
> 3. read/display "SpecialRetrnFile"
>
> How could I implement the linux daemon mechanism ? Or are their other
> more sophisticated but not too complex methods of doing such
> client-server transactions?
>
> == TIA.
>
> PS. right now, I'm writing this with 'the other system'
> which will "News.Send <theFile>"; but will use the linux ppp to post
> the News.
>
> PSS. I just did: 'top > /root/top'
> But '/root/top' is accumulating instead of renewing ?!


i'm assuming here but it seems that your 'nice system'
creates files in a directory within the system hierachy (which
you shouldn't do if it can be avoided)

and that you need a linux program (newer kernels received a nice mechanism
for doing this in kernelspace iirc http://en.wikipedia.org/wiki/Inotify )
or script (which will do fine mostly) that informs you when the directory
and/or files to which your nice system writes to changes ?

am i correct ?