unix

How to config Apache & php run as superuser

i try to config apache & php for my project to create web-based for file config management to open vpn in bsd unix, but i can't run as superuser to start or stop service ...

What if one of my programs runs in python 2.4, but IMPORTS something that requires python 2.5?

Then how do I import that? I run everything in python 2.4, but one of my scripts import xml.etree.ElementTree...which is only Python 2.5 ...

What did Ken Thompson mean when he said, "I'd spell create with an 'e'."

Ken Thompson, the creator of Unix, was once asked what he'd do if he had it to do over again. He said, "I'd spell create with an 'e'." What is Ken referring to? Is there a "creat" command? ...

How can I delete all /* */ comments from a C source file?

I have a C file which I copied from somewhere else, but it has a lot of comments like below: int matrix[20]; /* generate data */ for (index = 0 ;index < 20; index++) matrix[index] = index + 1; /* print original data */ for (index = 0; index < 5 ;index++) How can I delete all the comments enclosed by /* and */. Sometimes, the comment...

Bash script always true

Is there any reason this script always give me running ? In both cases, when my process is started and when my process is stopped. if ps ax | grep -v grep | grep "processName" > /dev/null then echo $"running" else echo $"not running" fi Thank you very much UPDATE : I add a full exemple of my script, maybe smothing wrong somewhe...

longjmp() from signal handler

I'm using the following code to try to read an input from user and timeout and exit if more than 5 seconds pass. This is accomplished through a combination of setjmp/longjmp and the SIGALRM signal. Here's the code: #include <stdio.h> #include <setjmp.h> #include <unistd.h> #include <string.h> #include <sys/signal.h> jmp_buf buffer; /...

System-V message-queue PHP C++

I am wondering what are the limitation of System-V message queue i.e. Maximum queue size, maximum size per item etc. As I am working on integration of C++ with my PHP scripts and have very large amount of data which will be pushed into queue from php and C++ process will read that data on the other end. I have devised an strategy in whi...

Multiple rows share a value in a column, how do I put all of these rows into one single row?

Hi, I'm working with a text file that looks something like this: rs001 EEE /n rs008 EEE /n rs345 EEE /n rs542 CHG /n re432 CHG /n I want to be able to collapse all of the rows that share the same value in column 2 into one single row (for example, rs001 rs008 rs345 EEE). Is there an easy way to do this using unix text proces...

practical examples use dup or dup2

Hi, I know what does dup or dup2 do ,but I have no idea when it would be used. Any practical examples? Thanks. ...

Cannot write a script to "svn export" in Python.

Hi, I would like to write a script that will tell another server to SVN export a SVN repository. This is my python script: import os # svn export to crawlers for s in ['work1.main','work2.main']: cmd = 'ssh %s "cd /home/zes/ ; svn --force export svn+ssh://174.113.224.177/home/svn/dragon-repos"' % s print cmd os.system(cmd)...

I just installed a Ubuntu Hardy server. In Python, I tried to import _mysql and MySQLdb

But, they were unable to be found!? How do I install both of them? ...

return a default row in sql

Is it possible in oracle sql to return a default row if no rows found. I have a process where in rows fetched will be put in a flat ascii file. now i have a requirement that if there are no rows fetched by the sql query then there should be a default row in the ascii file. is it possible in sql to output a default row if no rows fetched...

unix join separator char

Sorry for the maybe trivial question. I fought a bit with the unix join command, trying to get tabs instead of whitespaces as the default separators. -t is the argument, but these don't work (ubuntu 9.10 64 bit 2.6.31-14, GNU coreutils version 7.4) join file1 file2 -t"\t" join file1 file2 -t="\t" join file1 file2 -t="\\t" join file1 fi...

Unix Script not running in Java using Process Runtime

Hello All... I am developing an application where i required to run some of the scripts of unix from Java Code. Platform i am using is Unix, Tomcat 5.5.. For that, My Sample Code is as follows : Runtime runtime = Runtime.getRuntime(); Process proc = runtime.exec("netstat -i|tail -n +3|cut -d ' ' -f1"); System.out.println("exitValue =...

Is user + sys time equal to real/wall clock time?

In Perl: my ($usr,$sys,$cusr,$csys) = times; printf "real %s, user %s, sys %s\n", $usr + $sys, $usr, $sys; Is this true? I read some other questions where people did things like saving the current time away in a variable and collecting it later, but why wouldn't this work? ...

What do programs see when ZFS can't deliver uncorrupted data?

Say my program attempts a read of a byte in a file on a ZFS filesystem. ZFS can locate a copy of the necessary block, but cannot locate any copy with a valid checksum (they're all corrupted, or the only disks present have corrupted copies). What does my program see, in terms of the return value from the read, and the byte it tried to rea...

system call does not work same as command line

Ok I have two programs, and one calls another using executable from another. I am running it on Ubuntu terminal This is folder structure in place .../src/pgm1/pgm1 .../src/pgm0/pgm0 pgm1 and pgm0 are executables. This is how I call the other executable char cmd[1000]; string path = "/home/usr/src/"; // call pgm0 for e...

Is there a way to edit a symlink without deleting it first?

So I created a symlink: ln -s /location/to/link linkname Now I want to change the location that the symlink links to. How do I do that? is there a way to do it without deleting it first? ...

How do I get hardware information on Linux/Unix?

How I can get hardware information from a Linux / Unix machine. Is there a set of APIs? I am trying to get information like: OS name. OS version. available network adapters. information on network adapters. all the installed software. I am looking for an application which collects this information and show it in a nice format. I ha...

SQL*Plus inside Perl script

I am having a prior knowledge of shell scripting. I am trying to connect to a table using SQL*Plus and fetch the data in a Perl script and store that output in a Perl variable. Normally in a shell script I would do like below: SQL_RESULT=`sqlplus -s ${CONNECT_STRING} << EOF ${SQLPLUS_SETTINGS} select foo||'|'||bar ||'|'|| xy...