linux

C++ code to check the status of a process if it is Running, Stopped, Sleeping or a Zombie on linux from its pid.

I am kind of creating a watchdog which keeps the status log of other processes whose pids are known. I wana know if there is some c++ or c code to get this functionality. ...

CVS Diff to output only modified files?

Is it possible? Run a cvs diff in terminal at the project root that outputs only modified files (like local files that aren't in source control and local modified files - mainly what I did to my project). I'm running cvs diff --brief but I still have too many results since my project is large, and with a lot of subdirectories - it shows...

Multi-threaded random_r is slower than single threaded version.

The following program is essentially the same as the one described here. When I run and compile the program using two threads (NTHREADS == 2), I get the following run times: real 0m14.120s user 0m25.570s sys 0m0.050s When it is run with just one thread (NTHREADS == 1), I get run times significantly better even th...

writing data onto a linux live-dvd

Hi All, I have a server machine with a dvd-writer. I want to burn a linux live-dvd (openSUSE is preferred) with a pre-configured web server, so that after booting the web server should be ready to serve. The web server has a sqlite database (with very less data). But after rebooting the system, all data in the database will get lost. I...

Linux system() command

I am running system("cmd") for n number of times in my cgi script This is read by Ajax on the client side. Out of n number of times there are some cases when the cmd couldn't be executed as file is not available. I want my system() call to work everytime and output something. What is happening now is that, it just prints the last value. ...

How to extract random screenshots from a swf file? In Linux

Hi, I need to automatically extract some random screenshots from Flash content (swf) in linux. I will appreciate any advice on this. Thanks in advance. ...

Converting AVI Frames to JPGs on Linux

What program on Linux would allow you to convert all the frames in an AVI into a series of JPEG files? ...

Downloading all files from an FTP Server

I need to download everything from an FTP server to hosting on a different server. I have shell access only to the server I'm downloading the files to. How, using the Linux FTP comnand, can I download every file, creating the directories needed for them in the process? ...

including tk.h and tcl.h in c program

hi, i am working on an ubuntu system. My aim is to basically make an IDE in C language using GUI tools from TCL/TK. I installed tcl 8.4, tk8.4, tcl8.4-dev, tk8.4-dev and have the tk.h and tcl.h headers file in my system. But, when I am running a basic hello world program it's showing a hell lot of errors. #include "tk.h" #include "stdio...

Regarding Shell variable

I need to call another shell script testarg.sh within my main script. This script testarg.sh has arguments ARG1 ,ARG2, ARG3. I need to call up the below way: ./testarg.sh -ARG1 <value> -ARG2 <value> -ARG3 ARG1 and ARG3 arguments are mandatory ones. If it's not passed to the main script then I quit. ARG2 is an optional one. If the ...

Regarding PID Shell Script

I am calling another shell script testarg.sh within my main script. the logfiles of testarg.sh are stored in $CUSTLOGS in the below format testarg.DDMONYY.PID.log example: testarg.09Jun10.21165.log In the main script after the testarg process gets completed i need to grep the log file for the text "ERROR" and "COMPLETED SUCCESSFULLY...

Sysfs for the SPI device

Hi, How can I use the sysfs to detect if my hardware module(e.g. MSR) execute an event or an interrupt? ...

Dynamic loaded libraries and shared global symbols

Since I observed some strange behavior of global variables in my dynamically loaded libraries, I wrote the following test. At first we need a statically linked library: The header test.hpp #ifndef __BASE_HPP #define __BASE_HPP #include <iostream> class test { private: int value; public: test(int value) : value(value) { std::...

postgresql database default location on linux

What is the default directory where postgresql will keep all databases on linux? ...

How do you run multiple programs from a bash script?

I am trying to write a .sh file that runs many programs simultaneously I tried this prog1 prog2 But that runs prog1 then waits until prog1 ends and then starts prog2... So how can I run them in parallel? Thanks ...

Portable way of counting milliseconds in C++ ?

Hi, Is there any portable (Windows & Linux) way of counting how many milliseconds elapsed between two calls ? Basically, I want to achieve the same functionnality than the StopWatch class of .NET. (for those who already used it) In a perfect world, I would have used boost::date_time but that's not an option here due to some silly rule...

How can I login linux using C or C++

I need to programmely switch the current user to another,then the followed code should be executed in the environment(such as path,authority..) of another user. I've find the 'chroot()','setuid()' may be associated with my case, but these functions need the root authority, I don't have root authority, but I have the password of the seco...

for loop range not working ksh

I tried this, #!/bin/ksh for i in {1..10} do echo "Welcome $i times" done in Ksh of an AIX box. I am getting the output as, Welcome {1..10} times What's wrong here? Isn't it supposed to print from 1 to 10?. Edit: According to perkolator's post, from http://stackoverflow.com/questions/1591109/ksh-iterate-through-a-range It wor...

Regex to find external links from the html file using grep

hello, From past few days I'm trying to develop a regex that fetch all the external links from the web pages given to it using grep. Here is my grep command grep -h -o -e "\(\(mailto:\|\(\(ht\|f\)tp\(s\?\)\)\)\://\)\{1\}\(.*\?\)" "/mnt/websites_folder/folder_to_search" -r now the grep seem to return everything after the external li...

Displaying information on non-installed RPM package?

Hello I googled for this, but couldn't find how to query a non-installed RPM file for its information: # rpm -qa blackfin-jtag-tools-09r1.1-2.i386.rpm # # rpm -qi blackfin-jtag-tools-09r1.1-2.i386.rpm package blackfin-jtag-tools-09r1.1-2.i386.rpm is not installed # # rpm -q blackfin-jtag-tools-09r1.1-2.i386.rpm package blackfin-jtag-...