Showing posts with label Redhat. Show all posts
Showing posts with label Redhat. Show all posts

Tuesday 21 November 2017

How to clear catalina.out without disabling further logging

Delete Apache Tomcat catalina.out log


Step 1 : Go to apache tomcat log directory
 
                     [root@centos ~]#   cd /apache-tomcat-8.5.12/logs/


Step 2 :  Clear the file catalina.out



                       [root@centos ~]#  echo > catalina.out





Tuesday 24 January 2017

Backup Directories to Google Drive Automatically on CentOS/Red Hat


This tutorial explains how to backup directories to google drive.

1. Install google drive.

            Use the following link ti download google drive

           https://drive.google.com/open?id=0B2iJNfzwHersOVYzV0xsa09SZ1U

2. Move this file to "/usr/sbin/" folder.
  
       
           [root@centos ~]# mv drive /usr/sbin/drive





3. Assign right permission to the file.

              [root@centos ~]# chmod 755 /usr/sbin/drive


 


4. Now run command "dive". It will ask authentication.

      You will get a link like this.

"https://accounts.google.com/o/oauth3/auth?client_id=3453453533-7n0vf5gghru6on6o3fjinrghpdoe88eg.apps.googleusercontent.com&redirectghct_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.goohgheapis.com%2Fauth%3Fdrive&state=state"

  Go  to the above link on browser, you will get verification code. Type verification code and hit Enter.






5. Create backup script.

----------------------------------------------------------------------------------

#!/bin/sh


# tar the bkp directory
tar -zcf "dir-backup-$(date '+%Y-%m-%d').tar.gz" /root/AAA/aby/

# encrypt the tar
#openssl aes-256-cbc -a -salt -in "dir-backup-$(date '+%Y-%m-%d').tar.gz" -out "dir-backup-$(date '+%Y-%m-%d').tar.gz.enc" -pass 'pass:123456'

# remove the original tar
#rm -rf "dir-backup-$(date '+%Y-%m-%d').tar.gz"

# upload to google drive
drive upload --file "dir-backup-$(date '+%Y-%m-%d').tar.gz" -p 0B2iJNfzwHersN3Yxa0N3U1lqeU0

----------------------------------------------------------------------------------------------------------------------





6. Execute the script.




You can Schedule this script on crontab and schedule this autobackup.




Tuesday 20 September 2016

How to Start apache tomcat server on startup in Ubuntu,LinuxMint

1. First install the apache server.


                           http://rapidsolutions4u.blogspot.in/2016/09/install-apache-tomcat-on-linux-1.html

2. Go to init.d directory.


                                # cd /etc/init.d


3. Create and edit "tomcat.sh" file.


                                # vim tomcat.sh


    # Tomcat auto-start
    # description: Auto-starts tomcat
    # processname: tomcat
    # pidfile: /var/run/tomcat.pid

    export JAVA_HOME=jdk path


    case $1 in

    start)
            sh /home/apache-tomcat-8.5.4/bin/startup.sh
            ;;
    stop)
            sh /home/apache-tomcat-8.5.4/bin/shutdown.sh
            ;;
    restart)
            sh /home/apache-tomcat-8.5.4/bin/shutdown.sh
            sh /home/apache-tomcat-8.5.4/bin/startup.sh
            ;;
    esac
    exit 0


4. Save the file.

5. Set permission to created file.

                               # sudo chmod 755 /etc/init.d/tomcat

6. Create links


                               # sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
                              # sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat


7. Restart tomcat service.



                             # /etc/init.d/tomcat restart



8. Similarly stop and restart tomcat service.




Monday 19 September 2016

How to Start apache tomcat server on startup in Centos,Redhat


1. First install the apache server.


                           http://rapidsolutions4u.blogspot.in/2016/09/install-apache-tomcat-on-linux-1.html

2. Go to init.d directory.


                                # cd /etc/init.d


3. Create and edit "tomcat.sh" file.


                                # vim tomcat.sh


#!/bin/bash  
# description: Tomcat Start Stop Restart  
# processname: tomcat  
# chkconfig: 234 20 80  
JAVA_HOME=jdk path 
export JAVA_HOME  
PATH=$JAVA_HOME/bin:$PATH  
export PATH  
CATALINA_HOME=apache path  
 
case $1 in  
start)  
sh $CATALINA_HOME/bin/startup.sh  
;;   
stop)     
sh $CATALINA_HOME/bin/shutdown.sh  
;;   
restart)  
sh $CATALINA_HOME/bin/shutdown.sh  
sh $CATALINA_HOME/bin/startup.sh  
;;   
esac      
exit 0


4. Save the file.

5. Set permission to created file.

                               #  chmod 755 tomcat

6. Add on startup


                               # chkconfig --add tomcat
                               # chkconfig --level 35 tomcat on


7. Start tomcat service.



                             /etc/init.d/tomcat on


8. Similarly stop and restart tomcat service.