linux

Using "top" in Linux as semi-permanent instrumentation

I'm trying to find the best way to use 'top' as semi-permanent instrumentation in the development of a box running embedded Linux. (The instrumentation will be removed from the final-test and production releases.)My first pass is to simply add this to init.d:top -b -d 15 >/tmp/toploop.out &This runs top in "batch" mode every 15 seconds. ...

On a unix/linux system how can I learn more about a mylib.a archive?

In this particular case I'm trying to discover if a mylib.a file is 32 or 64 bit compatible. I'm familiar with ldd for shared objects (mylib.so) but how do I inspect a regular .a archive? ...

How do I stop visitors directly accessing the directories in my website?

I have a (Wordpress powered) website, and Google is indexing some of the sub-directories. How can I stop Apache from showing users the directory listing? I know I can edit .htaccess to password-protect a directory, but I would prefer a 403 / custom redirect if possible. ...

Is it possible to limit standard streams available to linux at the process level?

I would like to be able to spawn a linux process that would only have access to stdin, stdout, and stderr (nothing more and nothing less). Can I do this at the process level itself? I am also implicitly stating (oxymoron) that I don't want the spawned process to be able to change the "thing" that the other end of the stream points to. ...

Quick-and-dirty way to ensure only one instance of a shell script is running at a time

What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time? ...

What's the best way to find a string/regex match in files recursively? (UNIX)

I have had to do this several times, usually when trying to find in what files a variable or a function is used. I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways. ...

Deploying web apps that use cron

What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates, ...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the crontab? I know that the actual cron files are stored in /var/spool/ b...

How do I code a Mono Daemon

I'm trying to write a Mono C# daemon for linux. I'd like to do a starts and stops of it when its done processing instead of just killing the process. Does anyone have any examples of this? Edit: I figured out how to use start-stop-daemon --background in debian, so I think I'll just use that for now. Edit: I'm implementing this in jav...

Does a user need admin rights to install Flash player?

Will users who do not have admin rights on their computers be able to upgrade to new Flash player version by themselves? This would be interesting to know for: Windows 98 Windows XP/2000/Vista Macs Unix/Linux ...

Best security practices in Linux

What security best-practices would you strongly recommend in maintaining a Linux server? (i.e. bring up a firewall, disable unnecessary services, beware of suid executables, and so on.) Also: is there a definitive reference on Selinux? EDIT: Yes, I'm planning to put the machine on the Internet, with at least openvpn, ssh and apache (at...

How to copy file from linux to windows server using c

I have to create a C program which will run on Linux server. It will take information from Oracle database, create a local file and then copy that file to Windows server. I know how to create a local file on Linux server. But what is the way to copy it to windows server from C? ...

How to make a python, command-line program autocomplete arbitrary things NOT interpreter

I am aware of how to setup autocompletion of python objects in the python interpreter (on unix). Google shows many hits for explanations on how to do this. Unfortunately, there are so many references to that it is difficult to find what I need to do, which is slightly different. I need to know how to enable, tab/auto completion of ...

VisualStudio2005 debug into remote Linux webserver

I am debugging VisualStudio 2005 webservice client software, accessing a Linux webserver. VisualStudio has MSVSMON.exe for remote debugging of webserver code. Is there an equivalent debug-monitor for Linux? ...

Automatically kill process that consume too much memory or stall on linux

Problem: I would like a "system" that monitors a process and would kill said process if: the process exceeds some memory requirements the process does not respond to a message from the "system" in some period of time I assume this "system" could be something as simple as a monitoring process? A code example of how this could be done ...

Is there a fix or a workaround for the memory leak in getpwnam?

Is there a fix or a workaround for the memory leak in getpwnam? ...

Upgrade Subversion 1.4.3 to 1.5.2 on Debian (hosted account)

I'm trying to upgrade my subversion server (I have it hosted with Dreamhost) This is what I run: wget http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2 wget http://subversion.tigris.org/downloads/subversion-deps-1.5.2.tar.bz2 tar -xjf subversion-1.5.2.tar.bz2 tar -xjf subversion-deps-1.5.2.tar.bz2 cd subversion-1.5.2 ./c...

Where is the itoa function in Linux ?

itoa() is a really handy function to convert a number to a string. Linux does not seem to have itoa(), is there an equivalent function or do I have to use sprintf(str, "%d", num) ? ...

How do I use micro-state accounting in Linux?

I would like to access micro-state accounting timers programmatically on Linux. I guess the first part of the question is where are these available? Which kernel versions and distros? Which hardware platforms? The second part is how to actually go about accessing the timers? What is the system call? Here is a (somewhat old) page describ...

How to extract RPM from RPM database in RedHat

Is there a way to extract an installed RPM from an RPM database on RedHat Linux to reproduce the original .rpm file? ...

How to stop java process gracefully?

How to stop java process gracefully in Linux and Windows? When does Runtime.getRuntime().addShutdownHook gets called, and when it does not? What about finalizers, do they help here? Can I send some sort of signal to java process from shell? I am looking for preferably portable solution. Thanks, ...