unix

Getting the uptime of a SunOS UNIX box in seconds only

How do I determine the uptime on a SunOS UNIX box in seconds only? On Linux, I could simply cat /proc/uptime & take the first argument: cat /proc/uptime | awk '{print $1}' I'm trying to do the same on a SunOS UNIX box, but there is no /proc/uptime. There is an uptime command which presents the following output: $ uptime 12:13pm up ...

siginterrupt() only works for the first signal? (Python)

For some reason, siginterrupt() only seems to set the behaviour for the first signal received. In this example program, the first SIGQUIT appears to do nothing, but the second sigquit prints "SIGQUIT Handler" and s.accept() throws an Interrupted system call exception. from signal import * from socket import * import sys def sigquitHan...

In php, when working with very small numbers, how can i see the exact number, and not "2.1934509277344E-5" ?

Hi, I am working with microtime() to time some scripts, but all the scripts have really quick times, eg 2.1934509277344E-5 how can i get php to display that correctly without e-5? (which i assume is 0.000021934509277344? long time since i did maths...) ...

How do I fix this sed problem with unterminated lines?

I'm guessing this has to be an escaping issue, but I can't find it. What's most frustrating is that this is based on an old sed script I used that worked, so why can't I make it work when I try to re-use it a year later? ;) Framework: I have a file with a list of filenames in it that all need the same string of HTML searched and repla...

Mount a filesystem using python

I'm sure this is a easy question, my Google-fu is obviously failing me. How do you mount a filesystem using Python (i.e the equivalent of running the shell command mount ...). Obviously you can use os.system to run the shell command, but surely this is a nice tidy, python interface to the mount system call. I can't find it (I thought i...

gethostbyname problem

I wish to use "gethostbyname" in my Suse m/c but it is not returning any structure. but on the other systems it is working fine what could be the issue with my m/c ?? ...

How the Scala script that reads 5G log file from network drive should be modified in order to read last x lines (like 'tail' in Unix)?

How the Scala script that reads 5G log file from network drive should be modified in order to read last x lines (like 'tail' in Unix)? ::#! @echo off call scala %0 %* goto :eof ::!# import scala.io.Source if (args.length > 0) { for (line <-Source.fromFile(args(0)).getLines) if(line.contains("percent")){ print(line) } } ...

What non-Linux unixes support openat()?

openat() was added to POSIX in the POSIX.1-2008 revision, and has been supported by Linux since 2.6.16. How is support on non-Linux UNIXes? eg, Darwin, the *BSDs, and proprietary UNIXes. ...

How to see the version of the TAP file

this is a telecom based query. we receive TAP files from the clearing house. i want see on unix which version of TAP does it belong. how can i do it.Isthere any tool to find the TAP file version? ...

In UNIX shell scripting: What is $! ?

What is the meaning for $! in shell or shell scripting? I am trying to understand a script which has the something like the following. local@usr> a=1 local@usr> echo $a 1 local@usr> echo $!a a It is printing the variable back. Is it all for that? What are the other $x options we have? Few I know are $$, $*, $?. If anyone can point me ...

Key-value pairs in configuration file on unix - can the value contain the number sign (#)??

Hi, I'm using the openssl utility of debian in order to create a certificate. The certificate paramemters are given in a configuration file, which is made of key-value pairs. My problem is that I want one of the values to include the number sign (#). But openssl handles this sign as a beginning of comment, i.e. if my value is val#1, o...

How to find directories with the name of specific length

How could I find directories with the name of specific length? For example, I have bunch of directories which have length of the name equal to 33 chars ('a92e8cc611fdebcca3cf2fc8dc02c918', 'c442fb3f46d6c8bd17d27245290a9512' and so on). Does find utility accepts condition in form of the 'wc -c'? Or maybe some other utilities should be pi...

How to execute a command with one parameter at a time in the *nix shell?

Some commands like svn log, for example will only take one input from the command line, so I can't say grep 'pattern' | svn log. It will only return the information for the first file, so I need to execute svn log against each one independently. I can do this with find using it's exec option: find -name '*.jsp' -exec svn log {} \;. Ho...

new to mac.Permission issue with applications

Hellos good fellas! now i'm desparate. I feel like i'm turning round. when i believe solve something then i break something else. started using this mac this week.In the process of setting up my environment i face some challenge.I got a maven project which uses cargo plugin to publish to tomcat working fine.for that i had to google to c...

debugging a thread process using gdb/dbx

This might be genuine question but i am asking here since i was out of any clue when i was asked this question in an interview. how could we debug a thread which was created by another thread? let's say there is a main process and it calles the function pthread_create to create a thread process which is not joinable and that means both ...

Installing MySQL with archive

I am getting this error while compiling mysql 5.1 source with Archive Storage. Can someone point me to the correct way of enabling archive storage engine? ./configure --prefix=/usr/local/mysql --with-archive-storage-engine Parse errors: No plan found in TAP output mysys/my_atomic-t (Wstat: 0 Tests: 0 Failed: 0) Parse errors: No plan fo...

Is there any way to use UNIX GREP commands on WIndows operating system

All, I need some command like GREP in UNIX for WINDOWS Operating system, If there any way to use grep or any equivalent command in Windows? Please help ...

Is Solaris or Linux the better C GUI development environment?

What might be a better choice? I have my code (mostly C - as output from the GNU Eiffel compiler and some C++ for the GUI bindings) working with Sun Studio compiler and gcc. But i now have to setup a new developer computer and wonder if i should use Solaris with DTrace, locklint or Linux with Valgrind etc for development. It's just ab...

Can't Run Netbeans after changing Java to 1.6 on mac

Hello guys i know i've posting a lot about mac lately and setting up my environment to develop on java 1.6. after trying to set my etc/launch.conf like so setenv JAVA_VERSION 1.6 setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/ setenv CATALINA_BASE /Library/apache-tomcat6020 setenv CATALINA_HOM...

How to force a Http HEAD command to terminate (for HttpClient and curl) ?

If you run this command: $ curl -XHEAD -i -H "User-Agent: myuseragent" http://www.google.com HTTP/1.1 302 Found ... snip ... Server: gws Content-Length: 222 X-XSS-Protection: 0 you will notice immediately that the curl command hangs. (I am running this in cygwin/VISTA) If you run it against twitter or facebook, curl terminates immed...