The UNIX way.

Around the clock, across the globe. By Vladimir Legeza

Share several ZFS volumes over ISCSI. (example)

leave a comment »


#######################################################################################
root@openindiana# zpool status data_pool
pool: data_pool
state: ONLINE
scan: none requested
config:


NAME STATE READ WRITE CKSUM
data_pool ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
c4t0d0 ONLINE 0 0 0
c4t1d0 ONLINE 0 0 0
c4t2d0 ONLINE 0 0 0
c4t3d0 ONLINE 0 0 0
c4t4d0 ONLINE 0 0 0
c4t5d0 ONLINE 0 0 0
c4t6d0 ONLINE 0 0 0
c4t7d0 ONLINE 0 0 0
c4t8d0 ONLINE 0 0 0
c4t9d0 ONLINE 0 0 0
c4t10d0 ONLINE 0 0 0
c4t11d0 ONLINE 0 0 0
c4t12d0 ONLINE 0 0 0
c4t13d0 ONLINE 0 0 0
c4t14d0 ONLINE 0 0 0


errors: No known data_pool errors

Read the rest of this entry »

Written by Vladimir Legeza

April 1, 2013 at 7:58 am

Posted in ISCSI, Solaris, ZFS

Tagged with , , ,

Enable JRE on MacOS X 10.7

leave a comment »

Today I’ve tried to use iKVM for IPMI from SuperMicro.

At first try my browser download the .jnlp file and get “No Java runtime present …” when tries to feed it to the Java Web Start.

Installing JRE(7n15) from java.com had not solve that problem.

Problem was gone when after a quick search and dancing around solutions from can’t find JRE and Java for OS X I downgrade Java to version 1.6.0_41 (For Java versions 6 and below, Apple supplies their own version of Java. Java for OS X 2013-001) and execute these two commands:

$ defaults write com.apple.java.JavaPreferences WebComponentsEnabled -bool true
$ sudo ln -fs /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws

The second thing you should check if the previous receipt is not working for you is the JavaWebComponentVersionMinimum variable value. Originally I found this solution here.

To verify the current value of JavaWebComponentVersionMinimum in your system execute the following:
$ sudo /usr/libexec/PlistBuddy -c "Read :JavaWebComponentVersionMinimum" /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist

You now can make a decision to delete or change this value by changing Read command to Delete or Write respectively.

Written by Vladimir Legeza

February 21, 2013 at 6:29 pm

Posted in Java, OS, OS X

Tagged with , , , ,

Identify compatible controller driver on Solaris.

leave a comment »

Our task for today is to identify preinstalled Ethernet controller and find an appropriate device diver.

Any controller can be identified by its vendor and device ID’s.

Read the rest of this entry »

Written by Vladimir Legeza

February 17, 2013 at 5:55 pm

Update OS on hundreds of servers.

with one comment

Once I was asked about:
What would I do in case if I will need to update an OS on many, several hundreds for instance, servers without turning off the entire cluster?

And at that time I suggested a several ideas, nothing special, spontaneously, just in theory. Today I would like to share with you my recent practical experience in this area. Please read my and leave your comments and questions.

The first implementation was deployed few days ago and this is how it was done.

Read the rest of this entry »

Written by Vladimir Legeza

July 13, 2012 at 10:09 am

Bash script template

leave a comment »

Probably it will be a good idea not to write every script from a blank page, because the most scripts at the beginning contains the same information. like “what this pease of code does”, “who wrote it and when”, “default options declarations” and etc.

In following template I’ll define the most popular parts that all good scripts should contain. Also I figured out that adding --debug option is a very usefull thing that allows you to deep dive throught the code without extra manipulations.

Simple, clean, usefull:

#!/usr/bin/env bash
# Description:
#
# Execution frequency:
#
# Options:
#
# Author: Name e-mail DD/MM/YYYY
# Editions:

usage(){
echo “Usage:
}

ARGS=`getopt -o h --long help,debug -- $@`
eval set -- $ARGS

while true ; do
case “$1” in
-h| --help) usage; exit 0;;
--debug) set -x; shift;;
--) shift ; break ;;
*) echo “Internal error!“; usage; exit 1;;
esac
done

exit 0

Written by Vladimir Legeza

May 30, 2012 at 12:06 pm

Parallelization task in a shell script.

leave a comment »

Assume we have a 1000 files and we need to process each of them in a some way. File processing takes at least a 15 minutes. So, to process them all consistently we need aproximately 10 days. If we suppose that we will process them on a computer with more then one core, it would be logical to run some processes in parallel. But if we would start them all at the same time – our computer is going to be dead.

The following shell code defines a number of a processes that should be run concurrently, and supported the same number of concurrently running processes until the last file would not be processed.

PROC_IN_PARALLEL=3
FILES_LIST=1 2 3 4 5 6 7

processing(){
echo "Start processing file $1"
sleep 1
echo "File $1 is processed."
}

# Main loop
for i in $FILES_LIST; do
processing $i &
pid_list="$pid_list $!"

# Control of the concurrent processes
while [ `echo $pid_list|wc -w` -ge "$PROC_IN_PARALLEL" ] ; do
new_pid_list=
for pid in $pid_list ; do
if [ -d /proc/$pid ] ;then
new_pid_list="$new_pid_list $pid"
fi
done
pid_list=$new_pid_list
sleep 1
done

done

Read the rest of this entry »

Written by Vladimir Legeza

April 1, 2011 at 9:54 am

Network connection from the shell script.

leave a comment »

Shell allow users to send udp or tcp messages to the remote host and to receive replies  directly from the command line without any additional tools. It seems like a quite useful thing, but the functionality are limited to act only as a tcp/udp client, and not as a server.

The whole following code shows how to exploit this functionality. It should works properly in both major shell interpretors: Bash and Ksh.

host_name=localhost
port_number=80

exec 3<> /dev/tcp/$host_name/$port_number
echo -e "GET / HTTP/1.0\nHost: $host_name\n\n" >&3
while true ;do
read -r response <&3
echo $response
if [ -z "$response" ];then
break
fi
done
Read the rest of this entry »

Written by Vladimir Legeza

March 31, 2011 at 4:23 pm

Follow

Get every new post delivered to your Inbox.