Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

October 25, 2015

Shell script for Webfile Backup for webserver

#  mkdir /backups/web_backup/

#  vi /backups/webbackup.sh 
#!/bin/bash

export path1=/backups/web_backups
date1=`date +%y%m%d_%H%M%S`

/usr/bin/find /backups/web_backups/* -type d -mtime +3 -exec rm -r {} \; 2> /dev/null

mkdir $path1/$date1

cp -r /var/www/html $path1/

cd $path1/html

for i in */; do /bin/tar -zcvf "$path1/$date1/${i%/}.tar.gz" "$i"; done

if [ $? -eq 0 ] ; then
cd
rm -r /backups/web_backups/html
fi
done

:wq (save & exit)

Now schedule the script inside crontab:-
#The  script will run every night at 12 A.M
#crontab -e
0 0 * * * /backups/webbackup.sh > /dev/null


Please share your ideas and opinions about this topic. 
If you like this post, then please share with others.

Please subscribe on email for every updates on mail.

May 29, 2015

Password less authentication between linux servers

Password less authentication between linux servers:-
Source server:-192.168.2.11
Target server:-192.168.2.12

Hostfile entry On both source and target server:

cat /etc/hosts
192.168.2.11 server1.soumya.com server1
192.168.2.12 server2.soumya.com server2

On source server:-

# ssh-keygen -t rsa
# ssh-keygen -t dsa
# cd /root/.ssh
# cat id_rsa.pub >>authorized_keys
# cat id_dsa.pub >>authorized_keys
# scp authorized_keys root@server2:/root/.ssh/

On target server:-
# ssh-keygen -t rsa
# ssh-keygen -t dsa
# cd /root/.ssh
# cat id_rsa.pub >>authorized_keys
# cat id_dsa.pub >>authorized_keys
# scp authorized_keys root@server1:/root/.ssh/


Now lets test if both servers can ssh each other w/o password or not:-

on source server:-
[root@server1 ~]# ssh server2
Last login: Fri May 29 08:32:06 2015 from 192.168.2.50

[root@server1 ~]# ssh server2 date
Fri May 29 08:37:28 IST 2015


on target server:-

[root@server2 ~]# ssh server1
Last login: Fri May 29 08:38:00 2015 from server2.soumya.com

[root@server1 ~]# ssh server1 date
Fri May 29 08:38:14 IST 2015

So we can see both servers can connect each other without prompting for any password.

Happy learning...




Please share your ideas and opinions about this topic.

If you like this post, then please share with others.
Please subscribe on email for every updates on mail.

Upgrading Oracle E-Business Suite R12.2 Database from 12.1.0.2 to 19c - Part VII

    This post is continuation of the second part of the post :  Part VI Update the CDB initialization parameters On the database server no...