intercept stdout/stderr of another process or disowned process

2010-11-23 1 min read Bash Fedora Linux

The command is definately going to save your day if you have disowned the process by mistake. Only uses strace so might as well work on Solaris also, though not tried it.

intercept stdout/stderr of another process or disowned process

  <td>
    <div class="text codecolorer">
      strace -e write=1,2 -p $PID 2>&1 | sed -un "/^ |/p" | sed -ue "s/^.{9 }(.{50}).+/1/g" -e 's/ //g' | xxd -r -p
    </div>
  </td>
</tr>
1

Useful to recover a output(stdout and stderr) “disown”ed or “nohup“ep process of other instance of ssh.

Continue reading

bash script to run a command and take screenshot in every loop.

2010-09-24 2 min read Bash Fedora Learning Linux

Couple of days back, I had posted a command to display a stop timer with bash and echo. There I had also put the following gif file:

<img class="size-medium wp-image-2555" title="bash screenshot for the script output" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/09/temp-300x170.gif" alt="bash screenshot for the script output" width="300" height="170" />

Here the tricky part was to capture the jpg&#8217;s to create the gif file.

Preparation:

  1. Rename the terminal to aka – amit-capture

  2. Execute the command once with the import command and check the output and jpg&#8217;s

    Continue reading

\[Solution\] Solaris issue with wget not resolving Domain name (DNS name lookup failure)

2010-08-09 2 min read Solaris

Today I was working with <a class="zem_slink" title="Solaris (operating system)" rel="homepage" href="http://oracle.com/solaris">Solaris and after I had set up the <a class="zem_slink" title="NIS+" rel="wikipedia" href="http://en.wikipedia.org/wiki/NIS%2B">NIS+, <a class="zem_slink" title="Name server" rel="wikipedia" href="http://en.wikipedia.org/wiki/Name_server">DNS server, IP Address and completing the basic setting. I was using the pkg-get util from the freesunware.com

The utility was using wget and it was failing constantly. From the looks of it, it was very clear that the wget utility was unable to find the <a class="zem_slink" title="IP address" rel="wikipedia" href="http://en.wikipedia.org/wiki/IP_address">IP address from the name. <a class="zem_slink" title="Name resolution" rel="wikipedia" href="http://en.wikipedia.org/wiki/Name_resolution">Name resolution was not happening, while dig and <a class="zem_slink" title="Nslookup" rel="wikipedia" href="http://en.wikipedia.org/wiki/Nslookup">nslookup was able to do the DNS lookup.

Continue reading

Free Solaris Ebook

2010-07-15 1 min read Solaris

Please consider donating to the authour of the book if you can afford to. The book is really good.

<a href="http://teachmesun.com" target="_blank">http://teachmesun.com

Solaris one liners

2010-06-29 11 min read Solaris

http://www.unixguide.net/sun/sunoneliners.shtml

Unix/Solaris: One-Liners

Source: http://www.kevlo.com/~ebs/unix_commands.txt

Listed here are a bunch of unix commands.

–> change file date stamp

touch –t 199906042020 filename

–> move partitions

ufsdump 0f – /dev/rdsk/c0t0s0s0 | (cd /home; ufsrestore xv -)

–> lay down file system with 1% minfree and inode density

newfs –m1 –i81920 /dev/rdsk/c0t0d0s0

–> check file system

fsck /dev/rdsk/c0t0d0s0

Q: starting sybase

login as sybase, run: ./install/RUN_SYBASE

Q: logging in as sybase sa

isql -U sa

Continue reading

More solaris commands

2010-06-29 2 min read Solaris

These commands are taken from various sources and are quite helpful for day to day work on solaris.

For find n grep

grep -i m_forwardingProxy `find . -name \*cpp`

grep -i XVarBind `find . -name \*h`

grep -i gSLEncodeMode `find .  -name &#8221;*.cpp&#8221; -o -name &#8221;*.h&#8221;`

 
 
Find:

find . \( -name &#8221;*.cpp&#8221; -o -name &#8221;*.h&#8221; -o -name &#8221;*.c&#8221; -o -name &#8221;*.cc&#8221; -o -name &#8221;*.inh&#8221; -o -name &#8221;*.inc&#8221; -o -name &#8221;*.sm&#8221; -o -name &#8221;*.asm&#8221; \)

Continue reading

ack on solaris – grep recursively.

2010-06-25 2 min read Solaris

<span style="background-color: #ffffff;">Some days back I posted an article on ack <a href="http://blog.amit-agarwal.co.in/2009/08/24/more-powerful-grep-ack/" target="_blank">here. Today I was working on Solaris 9 and the default grep installed on the system does not have the &#8221;-r&#8221; option to search recursively. So, you know for all the time I had to keep using find with grep to work with directories recursively. This was something similar to the one below:

<span style="background-color: #ffffff;">find . -type f -exec grep amit {} \;

Continue reading
Older posts Newer posts