linux

Perfmon-like for Linux?

In windows there is perfmon to monitor various performances aspects (called counters) of the system. Is there a perfmon-like for Linux? especially, in interested in... CPU usage (total/per process/in kernel) Memory usage (total/per process/in kernel) ...Is it possible to store this information in files for future analysis? ...

How to get "requests per second" for Apache in Linux?

In Windows for ASP, you can get it perfmon, but... How to get "requests per second" for Apache in Linux? ...

How to UDP Broadcast from Linux Kernel?

I'm developing a experimental Linux Kernel module, so... How to UDP Broadcast from Linux Kernel? ...

writing bash script to change text and write to a log

I have written a very simple bash script to help me migrate from dev to staging. What it does is it deletes all files in staging, copies the files over from dev to stage. However, the config.inc.php file needs to have the first instance of "dev" to be changed to "stage", and no other instance changed. Second, everytime I run it (I run...

Where do I go from here -- regarding programming?

I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open source or proprietary...

Logging terminal commands in *nix

Is there a way to log(/var/log) commands executed by users in the *nix terminal? ...

OpenMPI: All nodes run as node 0

I have a c++ program that is using the openMPI library to pass messages between different processors. It is a parallel program that uses a genetic algorithm to get a good solution for the traveling salesperson problem. I am trying to set up the MPI environment on my two dual processor computers at my house so that I can run it. When...

Where are all my inodes being used?

How do I find out which directories are responsible for chewing up all my inodes? Ultimately the root directory will be responsible for the largest number of inodes, so I'm not sure exactly what sort of answer I want.. Basically, I'm running out of available inodes and need to find a unneeded directory to cull. Thanks, and sorry for t...

Determining the TCP port number to which client got bound.

Hi, I create a TCP socket without bothering about the port number to bind to [socket.sin_port = 0]. However later on if I want to print the port number of client how do I do that? The client C application (on Linux) creates many clients which get connected to server. To debug issues I capture the traffic on ethereal. I thought of printi...

Automatic file transfer from HTML

I'm building a web application that guides my users through the configuration and installation of an application. It builds a set of configuration files dynamically, then sends them in an archive (.ZIP file) along with an installer for the application. The web page is generated from a linux shell script (sorry), and for security reason...

Is TCP Keepalive the only mechanism to determine a broken link?

I recently ran into a issue where intermediate link betweeen a TCP server and client was down. The client has the requirement of connecting to a secondary server if the primary server is down. When the primary server is bought down (Ex ..by doing ^C on the terminal), there is TCP shutdown sequence that gets through and client sucessfully...

Static functions in Linux device driver?

is there a reason why most function definition in device driver in linux code is defined as static? is there a reason for this? I was told this is for scoping and to prevent namespace pollution, could anyone explain it in detail why static definition is used in this context? ...

Linux: retrieve per-interface sent/received packet counters (ethernet, ipv4, ipv6)

On Linux, how can I (programmatically) retrieve the following counters on a per-interface basis: Sent/received ethernet frames, Sent/received IPv4 packets, Sent/received IPv6 packets. ...

How to arrange a Makefile to compile a kernel module with multiple .c files?

How to arrange a Makefile to compile a kernel module with multiple .c files? Here is my current Makefile. It was auto generated by KDevelop TARGET = nlb-driver OBJS = nlb-driver.o MDIR = drivers/misc EXTRA_CFLAGS = -DEXPORT_SYMTAB CURRENT = $(shell uname -r) KDIR = /lib/modules/$(CURRENT)/build PWD = $(shell pwd) DEST = /lib/modules/$...

How do I programatically restart a system service(not apache) from apache in linux?

I need to simple way to allow an end user to restart tomcat from a web page served from apache on the same box. We're trying to make it easy for our QC department to deploy a new version of our webapp to apache. We're using samba, but we need an easy way for them to stop / start the tomcat server before/after the deployment. This would...

How do you determine the amount of Linux system RAM in C++?

I just wrote the following C++ function to programatically determine how much RAM a system has installed. It works, but it seems to me that there should be a simpler way to do this. Can someone tell me if I'm missing something? getRAM() { FILE* stream = popen( "head -n1 /proc/meminfo", "r" ); std::ostringstream output; int...

How to instruct cron to execute a job every second week?

I would like to run a job through cron that will be executed every second Tuesday at given time of day. For every Tuesday is easy: 0 6 * * Tue But how to make it on "every second Tuesday" (or if you prefer - every second week)? I would not like to implement any logic in the script it self, but keep the definition only in cron. ...

In unix/linux how to you find out what group a given user is in via command line?

In unix/linux how to you find out what group a given user is in via command line? ...

Porting C++ lib/app on android

I want to port few C/C++ libraries to android, how feasible it would be e.g. openssl can it be ported or suppose an application which depends on openssl, what is the best way to port it to android when android i think itself has libssl.so what are the tools available e.g. scratchbox , any alternatives? Has anybody experience with it? ...

What is the best Linux book that you've read?

1 book per post please. What books would you recommend for a beginner or for the experienced developer/user (most people who use it are both anyway). ...