Sunday, April 17, 2016

script to check if the file exists

#!/usr/bin/ksh
## This is a simple script to check if the file exists in a dir or not
## Created by : Arvind Reddy
## This will prompt for

echo " file name please : "
read FILENAME;
export dataDir=/u01/app/oracle/dpump;  ## change this to directory you want check the file
sourceFile=SCOTT.dmp;                         ## Filename you want to check for

cd /u01/app/oracle/dpump;
echo `pwd`

##Did we get a file?

if [ -e ${dataDir}/${sourceFile} ];then
echo "Found file !! "
else
echo " No file found !!! "
fi

copying files from host OS to guest OS on Virtual Machine

 Configuring file copy from host machine to  Guest OS and from guest OS to host machine in avirtual box environment. This will be helpful when you have some files downloaded on you Host mahine and you want to copy them to Guest OS.

On virtual box Guest OS  click on devices and select shared folder as bellow screen







Then select the folder on your Host machine's directory that you want to share between host 
and guest OS.












Once you have selected the right directory make it read-only if you want to just read files from that directory. Also select auto-mount so you can have this folder always mounted when you restart/start you guest OS.

Friday, April 15, 2016

adding user and groups in Linux

Create the new groups and user .


groupadd ggowner  ## Adding new group ggowner

useradd -g ggowner -G dba,oper gguser ## Adding new user gguser & add to groups default ggowner additional dba,oper,oinstall


WE CAN QUERY THESE NEW USERS IN LINUX:


[root@Linux03 Desktop]# cat /etc/passwd |grep gguser

gguser:x:501:501:golden gate user:/home/gguser:/bin/bash

gguser1:x:502:54331::/home/gguser1:/bin/bash


LOGIN AS NEW USER :


[root@Linux03 Desktop]# su gguser


CHECK THE GROUPS GGUSER IS PART OF :


[gguser@Linux03 Desktop]$ id

uid=501(gguser) gid=501(gguser) groups=501(gguser),54321(oinstall),54322(dba),54330(ggowner) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c102