LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Make a program can collect linux command output regularly and send to a tftp server (https://www.linuxquestions.org/questions/programming-9/make-a-program-can-collect-linux-command-output-regularly-and-send-to-a-tftp-server-633714/)

fragon 04-07-2008 01:30 PM

Make a program can collect linux command output regularly and send to a tftp server
 
Hi all,

I intend to make a program that will collect commands output that I need and send it to a tftp server in every seconds.

I will make another python script at tftf server to collect and parse the information that I need to save. But I'm not really how to implement it yet because. No python, tcl/expect solution can be applied here because this is a small device that use busybox. Cpu/memory less consuming is a requirement to maintain device performance.

Does bash shell can help to get output of a command like top? Or is there any other way to solve this requirement

Thanks,

theNbomr 04-07-2008 02:00 PM

Why do you want tftp to be involved? If you are already going to write both server side and client side code, just write something that communicates directly between peers. This can be made very small if written in a compiled language such as C. There are many simple examples of how to do this; one of my favorites is Beej's Guide to Network Programming Bash is probably not the tool you want to use for this, especially in a resource-constrained environment.

--- rod.

fragon 04-07-2008 04:49 PM

Thanks for replying. I really like Beej's Guide to Network Programming. It is a great document to play with.

I'm stick with shell till now because I don't need to touch the low level code. I can just excuse
ifconfig eth0 > ifconfig%time.txt
then put that text file to tftp server to archive my goal

The thing I consider is the resource consuming that make my device slower and how to handle some special commands like top

Using C, I may go to the kernel, enhance commands with an option to be able to talk to my server to put information but it is too much for this requirement.


All times are GMT -5. The time now is 01:03 AM.