unix

syntax highlighting in vi

Is syntax highlighting there on vi?. I am sshing to an AIX box via putty in windows xp and using vi. I would like to know if there is syntax highlighting feature in vi.(My google-fu failed as all the results pertaining to vi point to vim). If this exists, Is it possible to get the colors in putty?.(I doubt it though, as sending the color...

Named pipe is using 100% CPU

I'm starting the script with ./file.py < pipe >> logfile and the script is: while True: try: I = raw_input().strip().split() except EOFError: continue doSomething() How could I better handle named pipe? This script always run at 100% CPU and it need to be real-time so I cannot use time.sleep. ...

Short writes to a UNIX file descriptor

When can a short write to a file descriptor occur in FreeBSD 7.2 ? I mean the situation when "write" system call returns less bytes written than requested. I'm speaking about descriptors to ordinary files in ufs filesystem which we can get with a call to open(). ...

Is there an equivalent to COM on *nix systems ? If not, what was the *nix approach to re-usability?

I have an understanding of windows COM and the ideas behind it. I am trying to understand if *nix systems even have an equivalent or why they don't? ...

Extract log file

Hi, xxxxxxxxmessageyyyyyyymessagexxxxxxxxxx xxxxxxxxmessagezzzzzzzmessagexxxxxxxxxx xxxxxxxxmessageaaaaaaamessagexxxxxxxxxx xxxxxxxxmessageyyyyyyymessagexxxxxxxxxx The above is my log file I need to extract the phrase which is inside the message tag and I need to save the distinct messages in a file in the above example I need to ...

git crlf configuration in mixed environment

I'm running a mixed environment, and keep a central, bare repository where I pull and push most of my stuff. This centralized repository runs on Linux, and I check out to Windows XP/7, Mac and Linux. In all repositories I put the following line in my .git/config: [core] autocrlf = true I don't have the flag safecrlf=true anywhere...

viewing foreground process using ps

Hi, I can see the background process using ps. But Is there a way to view the foreground process?. For example, $nohup process1 & then ps -ef | grep "process1" would display the process "process1" in execution. But the above command wouldn't show a foreground process executed like, $process2 Thanks in Advance. ...

apache & php 500 error nightmares

I was trying to add curl support to php on a VPS, and after logging in and trying to perform a php upgrade, my site gives me a 500 error every time I try to access it. So, I tried refreshing apache install with easyApache, and it went swimmingly outside of the fact that php scripts still didn't work. I decided there must be something g...

ack-grep: please help with chars escaping

My goal is to find all "<?=" occurrences with ack. How can I do that? ack "<?=" Doesn't work. Please tell me how can I fix escaping here? ...

schroot: pass a command to be executed as if it’s in a shell

i want to do something like: schroot -c name -u root "export A=3 && export B=4" but i get the error: Failed to execute “export”: No such file or directory In other words, I want to be able to programmatically execute shell commands inside the schroot environment. What is the right way to get this behavior? ...

ORA-00060: deadlock detected while waiting for resource

Hi, I have a series of scripts running in parallel as a nohup on an AIX server hosting oracle 10g. These scripts are written by somebody else and are meant to be executed concurrently. All the scripts are performing updates on a table. I am getting the error, ORA-00060: deadlock detected while waiting for resource As I g...

sequentially executing background processes unix

Hi, I have two scripts say 'S1' and 'S2'. I execute these scripts as, nohup S1 & nohup S2 & But I would like them to execute sequentially. ie., S2 should execute only on successful completion of S1. How should I go about doing this?. How can I know when S1 finishes execution?. Any examples would be much appreciated. T...

ORA-00054: resource busy and acquire with NOWAIT specified

Hi, I killed a script that was in the middle of updating a table. Now when I rerun the script I am getting, ORA-00054: resource busy and acquire with NOWAIT specified I presume the table is locked?. How do I unlock the table?. Thanks in advance. ...

Maximum number of page faults in two-level page table

What is the maximum number of page faults that can occur when trying to access a single page in a two-level page table? My guess is two. One if the second level table is not in memory and one if the page in the second level page table is not in memory. ...

Change Unix password from command line over Python/Fabric

I would like a way to update my password on a remote Ubuntu 10.4 box with fabric. I would expect my fabfile.py would look something like this: def update_password(old_pw, new_pw): # Connects over ssh with a public key authentication run("some_passwd_cmd --old %s --new %s" % (old_pw, new_pd)) Unfortunately the only command I k...

PHP FTP - Is there a way of seeing if FTP was initiated by PHP?

I have had an attack on my web server where .html files were copied by FTP into a public html directory. The FTP password was very strong. I'm trying to determin whether PHP initiated the FTP transfer. Is there an Apache or Nix log file that can give me this information? Additional information I have FTP log entries which seem to show...

'ls -l' in groovy

I need to display name, size, date of files using ls -l unix command in groovy . How can we run ls -l in groovy to view info ? thanks in advance. ...

determining if process has terminated successfully

Hi, I have some code to execute the unix shell command in background in python import subprocess process = subprocess.Popen('find / > tmp.txt &',shell=True) I need to capture the scenario where i come to know that process has finished successful completion . Please explain with sample code Tazim ...

How can I grep these lines

I want to grep lines starting with a @ and also lines starting with // followed by a line starting with @ Example: //text1 @text2 text3 result: //text1 @text2 How can I do this with grep or any other basic unix tool? ...

how to change relative url to absolute url in wget shell

Hi , i am writing one shell script to download and display the content from a site and i am saving this content in my local file system. i have used the following wget in the script to get the content : /usr/sfw/bin/wget -q -p -nH -np --referer=$INFO_REF --timeout=300 -P $TMPDIR $INFO_URL where INFO_REF is the page where i need to di...