Save Crontab Logfile with Date-Timestamps

15 15 * * * /u01/app/oracle/backups/scripts/test.sh >>/mnt/uranus/rman/logs/59_`date +\%Y\%m\%d\%H\%M\%S`.log

It will create ‘/mnt/uranus/rman/logs/59_201403171515.log’

Advertisements

My Useful “ls” Linux Comand

  1.             ls -laLR > print.txt
                

    to print permission of all files, folders include hidden file and symlinks

  2.             ls -dl 'find / -type d'
                

    to print permissions only folder

  3.             ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
                

    to print folder structure

Error: Protected multilib versions

When I “yum install libXext.i686 -y”, it failed because

Error: Protected multilib versions: libXext-1.3.1-2.el6.i686 != libXext-1.1-3.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Then I do again “yum install libXext.i686 -y –skip-broken”. but again another message like this

Error: Protected multilib versions: libXext-1.3.1-2.el6.i686 != libXext-1.1-3.el6.x86_64
 You could try running: rpm -Va --nofiles --nodigest

I have run these

package-cleanup --dupes
package-cleanup --cleandupes
yum clean all
yum update #take very long time to finish

Here the solution that work for me,

yum install libXext.i686 -y --setopt=proctected_multilib=false

Using NFS on RedHat to Share Folder

Server:

  • 192.168.51.57 have folder to share
  • 192.168.51.55 want to access folder in 192.168.51.57

On server 192.168.51.57

  • mkdir -p /home/pandazen/shared
  • nano /etc/exports
    /home/pandazen/shared 192.168.51.55(rw,no_root_squash,sync)
  • exportfs -ra
  • service nfs status
    rpc.svcgssd is stopped
    rpc.mountd is stopped
    nfsd is stopped
    rpc.rquotad is stopped
  • service nfs start
    Starting NFS services: [ OK ]
    Starting NFS quotas: [ OK ]
    Starting NFS mountd: [ OK ]
    Stopping RPC idmapd: [ OK ]
    Starting RPC idmapd: [ OK ]
    Starting NFS daemon: [ OK ]
  • rpcinfo -p | grep nfs
    100003 2 tcp 2049 nfs
    100003 3 tcp 2049 nfs
    100003 4 tcp 2049 nfs
    100227 2 tcp 2049 nfs_acl
    100227 3 tcp 2049 nfs_acl
    100003 2 udp 2049 nfs
    100003 3 udp 2049 nfs
    100003 4 udp 2049 nfs
    100227 2 udp 2049 nfs_acl
    100227 3 udp 2049 nfs_acl

On server 192.168.51.55

  • mkdir /mnt/boo
  • nano /etc/fstab
    192.168.51.57:/home/pandazen/shared /mnt/boo
  • mount -v -t nfs 192.168.51.57:/home/pandazen/shared /mnt/boo

Finish, then we can test create a textfile from 192.168.51.57 and then open it from 192.168.51.55.

Another app is currently holding the yum lock; waiting for it to exit

When using “yum install”, I got this message

Another app is currently holding the yum lock; waiting for it to exit

For example, when I’m done running “yum install-y binutils” then I proceed proceed to run “yum install compat-libcap1-y”, a moment later the message like this show up,

Another app is currently holding the yum lock; waiting for it to exit …
The other application is: PackageKit

. This message keep show repeatedly if I go with another “yum install”.

So to stop this, just edit PackageKit config in /etc/yum/pluginconf.d/refresh-packagekit.conf then change “enable=1” to “enable=0”

[Main] 
enabled = 0

Create Oracle Schedule Backup Script on Oracle Linux :

  1. create backup directory for USERME

    CREATE OR REPLACE DIRECTORY BCK_DIR AS ‘/home/oracle/bck’;
    GRANT READ, WRITE ON DIRECTORY SYS.BCK_DIR TO EXP_FULL_DATABASE;
    GRANT READ, WRITE ON DIRECTORY SYS.BCK_DIR TO IMP_FULL_DATABASE;

  2. using vi to create script

    #!/bin/bash
    clear
    #echo “Hello, linux world from pandazen world.”
    echo “backup pandazen data with script on Oracle Linux”
    NOW=$(date +”%Y%m%d”)
    FILE=”pandazen$NOW”
    echo $FILE

    #export data pump with compression
    expdp USERME/<PASSWORD> dumpfile=$FILE.dmp logfile=$FILE.log directory=BCK_DIR compression=all

    #archive with tar
    tar -cf $FILE.tar $FILE.dmp $FILE.log

    #compress again with gzip
    gzip $FILE.tar
    [ESC]
    :wq

  3. using crontab to schedule it

    crontab -e
    0 22 * * * /home/oracle/script/bckmis.sh
    [ESC]
    :wq