UnixTips.net

* use my tips at your own risk !!

* use my tips at your own risk !!

Categories

  • Other (3)
  • Scripting (10)
  • Unix (70)
  • Wordpress (2)

Powered by Genesis

Archives for December 2013

Solaris Ndd Parameters

Quick and dirty ndd for Solaris 5.10 Generic_148888-05

For APR parameters:

# ndd -get /dev/arp ?
?                             (read only)
arp_cleanup_interval          (read and write)
arp_publish_interval          (read and write)
arp_publish_count             (read and write)
arp_probe_delay               (read and write)
arp_probe_interval            (read and write)
arp_probe_count               (read and write)
arp_fastprobe_delay           (read and write)
arp_fastprobe_interval        (read and write)
arp_fastprobe_count           (read and write)
arp_defend_interval           (read and write)
arp_defend_rate               (read and write)
arp_broadcast_interval        (read and write)
arp_defend_period             (read and write)

Get a value for a specific parameter

# ndd -get /dev/arp arp_cleanup_interval
300000

Set the value

# ndd -set /dev/arp arp_cleanup_interval 60000

Confirm the value

# ndd -get /dev/arp arp_cleanup_interval
60000

Same thing for other parameters just use the the correct device:

# ndd -get /dev/tcp ?
tcp_time_wait_interval        (read and write)
tcp_conn_req_max_q            (read and write)
tcp_conn_req_max_q0           (read and write)
tcp_conn_req_min              (read and write)
tcp_conn_grace_period         (read and write)
...
...
...

All ndd values:

# ndd /dev/arp \?
# ndd /dev/ip \?
# ndd /dev/tcp \?
# ndd /dev/udp \?

Need to make sure your parameters are set upon boot up?

Create a file /etc/init.d/netconfig with your ndd settings:

# cat /etc/init.d/netconfig
#!/sbin/sh
# Disable IP Forwarding
/usr/sbin/ndd -set /dev/ip ip_forwarding 0
/usr/sbin/ndd -set /dev/ip ip_strict_dst_multihoming 1

Create a sym link to rc2.d:

# ln -s /etc/init.d/netconfig /etc/rc2.d/S69netconfig

Now this is not a standard the files may be named differently based on the system and may already be there. Just find the right file.

# cd /etc/rc2.d
# grep ndd * 
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_forwarding 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_strict_dst_multihoming 1
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_respond_to_address_mask_broadcast 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_respond_to_echo_broadcast 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_forward_directed_broadcasts 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_respond_to_timestamp 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_respond_to_timestamp_broadcast 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_send_redirects 0
S69netconfig:/usr/sbin/ndd -set /dev/ip ip_ignore_redirect 1
# ls -l S69netconfig
lrwxrwxrwx   1 root     root          21 Aug 30  2010 S69netconfig -> /etc/init.d/netconfig

Background And Foreground Commands , fg bg

The other day I was sitting in on a presentation by a co-worker. He was running a job that usually takes a while and and used the bg and fg commands. I was familiar with these commands but have not used them in a while.

Needless to say if you need a refresher or just learning this is how they work:

In this example I am using a simple while loop to play around with this.

#!/usr/bin/sh

NUM=1

while [ ${NUM} -gt 0 ]
do

echo "Just a Job"

done

Execute the script.

 # ./num.sh > num.out 

Press control-z to suspend the job.

 
[1] + Stopped                  ./num.sh > num.out

Your prompt will come back .. and execute the jobs command.
As you will see the job is stopped.

 
#
# jobs
[1] + Stopped                  ./num.sh > num.out
#

Now use the bg command to send the job to the background. If you execute the jobs command you will see the job us no longer in a “Stopped” state but is now running in the background. NOTE: jobs -l will show you the PID.

 
# bg
[1]     ./num.sh > num.out&
#
# jobs
[1] +  Running                 ./num.sh > num.out
# 
# jobs -l
[1] + 22495      Running                 ./num.sh > num.out

To kill job # 1 simply kill that job.

# kill %1

Or you can bring it back to the foreground by executing the fg command and wait for it to finish or control-c to kill it.

# fg
./num.sh > num.out

Windows Search ..

I know this is unixtips.net but I ran into an annoying issue after upgrading to Windows 7. It seems that after my upgrade I was no longer able to search the contents of my .txt and .log files that were on my PC.

Here is what I did.

Start -> "Search Programs and Files" -> Indexing Options -> Advanced

On the File Types Tab.

A bunch of file extensions will show up here.

Scroll down and choose txt .. In the “How should this file be indexed?” Make sure you choose “Index Properties and File Contents.”

Go through and check text too.

For .log files you can “Add new extension to list” and make sure you choose “Index Properties and File Contents.”

Thats it .. after indexing is complete you are golden.

Sorry no screenshots.