Executing commands on windows host from unix host

Many a times we may need to execute commands in host#2 from host#1, where in host#1 and host#2 can be windows or unix hosts. In this post I will be providing information on how to run commands from unix host (host#1) which gets executed on host#2 which can be a windows or unix host.

If host#2 is a unix host sshpass command be used on host#1 to execute commands on host#2. sshpass can be downloaded here
If host#2 is a windows host, winexe command can be used to host#1 to execute commands on host#2. Winexe can be downloaded here.

Both sshpass and winexe will be installed in host#1 and nothing needs to be installed in host#2. Commands gets executed on host#2 and any output will be displayed in host#1 which can be used for any further processing.

Posted in General Tech Discussion | Leave a comment

Zero to One

by Peter Thiel with Blake Masters. This book is all about startups.
What is zero to one ?. Creating something which does not exist is zero to one. Replicating an existing thing is one to N which is a wonderful concept. Startup’s always work form 0 to 1 and as such the name of book. Author has explained various things about how startup operate, how do they build product with minimum value proposition, releasing the product to market and various other stuff. Book also has some details about past 1998-2000 dot com boom where in everyone was willing to join a startup or start his own and what eventually led to the .com burst.

Author has explained couple of important things about founders and co-founders of company. Choosing co-founders while starting a company is very crucial. If the frequency of the founders does not match, company will cease to exist in future because of difference in opinion between founders. If one is joining a startup again it’s important to analyze the founding members to avoid undue risk in future. Also explained in detail are salary of founders and stock options provided to founders and employees and what could be worth of the stocks in future.

Overall a good book to read.

Posted in General Books | Leave a comment

The Lean Startup

An interesting book on how startup’s work. Some of the concepts like “Pivot or Preserve” and five ‘Y’ concepts can be adopted in general in any situation and is not unique to a startup company. Also most of the concepts, in general can be applied in all projects in large organizations too. It just needs a change the way the projects are managed. Even though i work in large organization, I adopted Minimum Value Proposition (MVP) and iterative model in one of the projects and it really worked well. One of the other notable thing which i remember is, office politics in large organizations – allocation of budget.
Recently read bad news about “Kqingdom ITES Pvt Ltd”. So entrepreneur should be very careful not to be obsessed with their idea and should decide on right time whether to pivot or preserve.

Book is worth a read for all.

Posted in Personality Development Books | Leave a comment

Java The Complete Reference, 9th Edition

I did search for 9th edition of book and isĀ available for download only as torrent. If you don’t have access to torrent sites, do email me ( iamnandans@gmail.com ) , i will send it across. Download the example programs in book from here.

Posted in Tech Books to Read | Leave a comment

The Obstacle is the Way

By Ryan Holiday

Everybody faces obstacles in life. How individuals reacts to the obstacle, how does he/she over comes the obstacle differentiates the individual from rest. Author has provided numerous examples of renowned individuals, obstacles they faced and how did they overcome them turning obstacles into advantages. It’s all about how individuals perceives the obstacle. When one overcomes obstacle, he/she learns various lessons as part it which will be stepping stop to success. Never ever think, if current problem is solved everything is solved. God has designed the universe in such a way that, next obstacle is ready to hit us. So obstacles are part of life. Don’t run away from them instead resolve them and move forward. “Prepare to start Again” is a must chapter to be read.

It’s a good motivation book especially if one is going through rough patch in life. I did like the book, hope others will.

Posted in Personality Development Books | Leave a comment

India 2020

by A.P.J Abdul Kalam and Y.S Rajan

Author being X President of India and held various top positions, has envisioned India in 2020. Writing a vision document of a country is not possible for all who haven’t held so many different top positions in government.
As the title of the book indicates, book is a vision of India in 2020. Book was written quite few years back and reading it now is a kind of evaluation of, have we achieved our vision. Author has explained in detail about, other countries vision of 2020, envisioned where India should stand in 2020 and what kind investment and focus is required on various sector. Some of the sectors author has explained are, Food, Agriculture and processing, materials like steel, aluminium and titanium, chemical industries (petrochemicals, phamaceutical chemicals, agro chemicals, textiles), manufacturing (CNC, CAD/CAM), services (financial, marketing, security, technical and management consultancy, trade promotion, tourism, leisure and sports… ). In final chapters, author explains how the central PSUs, state PSUs, big and small industries, MNCs, Academics and RnD labs, government and non-government organization can involve/help in achieving the vision.

This came to me as a surprise. In one of the chapters, author has mentioned that, When India achieved mile stones in aerospace and defense sector, western countries by publishing false statements tried to take away the credit from Indian scientists. This definitely shows that western countries want to control the world and does not want to let go off the power from their hands.

In some of the sectors, I think, we have surpassed the vision. This is mainly due to repaid change in technology which has resulted in solving problems with newer and easier approaches.

Posted in General Books | Leave a comment

All about Network File System (NFS)

As the name itself indicates it’s a file system on remote computer which can be accessed as a local filesystem on other computers in network.
Sharing file system in a network is a 3 step process
1. Start NFS service
To share/access files, NFS service should be running on the server which shares the file system. Download the script nfsServiceCheck, which check’s if NFS service is running and if it’s not running will start the service. This script caters to RHEL/SUSE/OEL and CentOS. For NFS service to be running properly, rpcbind service should be started first and then the NFS service, if it’s done in reverse order, file system cannot be exported. So make sure to start rpcbind service first and then the NFS service. Script attached in this post does take care of this while starting the NFS service. To use the script, create a shell script with the contents of file and execute the script (it does not accept any arguments) to start the rpcbind and NFS service. Script does not cater to stopping of service.

2. export the file system to other hosts in network
After the service is started, from the source server ( file system which needs to be accessed in other hosts ), filesystem should be exported.
If file system should continue to be exported even after system reboot, follow the below steps
#vi /etc/exports

Make the following entry in file
192.168.0.101(rw,sync,no_root_squash)
eg:
/nfsshare 192.168.0.101(rw,sync,no_root_squash)

Options:
ro: read only access to the shared files
rw: This option allows the client server to both read and write access within the shared directory.
sync: Sync confirms requests to the shared directory only once the changes have been committed.
no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger file system, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
no_root_squash: This phrase allows root to connect to the designated directory.
* can be specified in place of IP address to share to all hosts in network.
Do refer to man page for all options detail

execute the below command, to export the file system which was entered in /etc/exports file above
#exportfs

If file system need to be exported only for short duration and need not continued to be exported after system reboot, follow below steps
execute the following command
#exportfs -o ro,all_squash *:
eg: exportfs -o ro,all_squash *:/opt/omni/

3. Mount the file system in other hosts
After the filesystem is exported from source server, file system needs to be mounted on client system where it needs to be accessed.
#showmount -e 192.168.0.100
This command will display all the NFS shares exported on host 192.168.0.100

If file system should continued to be mounted even after system reboot, follow below steps
# vi /etc/fstab
192.168.0.100:/nfsshare /mnt nfs defaults 0 0

execute the below command, to mount the file system for which a entry was made in /etc/fstab file above
#mount -a

If file system needs to be mounted only for short duration and need not be remounted after system reboot, execute following command in shell
#mount 192.168.0.100:/nfsshare /mnt/

Now filesystem 192.168.0.100:/nfsshare is accessible on 192.168.0.101:/nfs/nfsshare

Unmount the share from client hosts
If entry was made in /etc/fstab file, remove the entry from file and then execute the command
#mount -a
If entry was not made in /etc/fstab file and file system was mounted using the mount command from shell, use the below command for unmounting
#umount /mnt/nfsshare

For unexporting the share from source system
If entry was made in /etc/exports file, remove the entry and execute the command
#exportfs
If file system was exported from shell without making an entry in /etc/exports file, use the below command to unexport the file system
#exportfs -u *:

Posted in Unix and Unix Internals | Tagged , , , , , , | Leave a comment