The yes command and a bit of its history

The yes command prints it’s argument repeatedly until killed. If no argument is given, it will print y until killed.
It seeemed useless right? Well, not exactly. If we have a script or a command that expects an answer Yes/No to continue, we can use the yes command to provide the answer.

yes No | script or command

Continue reading

Advertisements

Create init script for VMware tools in RHEL 6

I installed RHEL 6 on VMware ESXi 5.1 and after installing VMware tools, the installer did not add an init script for VMware tools. Which means service vmware-tools whatever will return unrecognized service. VMware has a KB article which tells us to use their own script but does not tell us how to create an init script.

Thankfully, this gentleman has the recipe and if you need to repeat it, here’s a quick script.

    # Create init script for VMware tools if it does not exist
    # http://klovsjo.free.fr/?p=70

    if [[ ! -e /etc/init.d/vmware-tools ]]
    then
            cp /etc/vmware-tools/services.sh /etc/init.d/vmware-tools
            sed -i 's/##VMWARE_INIT_INFO##/# Basic support for IRIX style chkconfig\n# chkconfig: 235 03 99\n# description: Manages the services needed to run VMware software\n/' /etc/init.d/vmware-tools
            chkconfig --add vmware-tools
            chkconfig vmware-tools on
    fi