1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

#!/bin/bash Cleaner.sh

Discussion in 'Other Scripting Languages' started by Morpheus696, Apr 11, 2016.

  1. Morpheus696

    Morpheus696 Registered Member

    Joined:
    Apr 11, 2016
    Messages:
    94
    Likes Received:
    41
    Gender:
    Male
    Occupation:
    I do stuff, people pay me.
    Location:
    /dev/null
    This script will remove log entries on Linux hosts.


    Code:
    #!/bin/bash
    
    #######################################################################
    
    #This program is free software: you can redistribute it and/or modify
    #it under the terms of the GNU General Public License as published by
    #the Free Software Foundation, either version 3 of the License, or
    #(at your option) any later version.
    
    #This program is distributed in the hope that it will be useful,
    #but WITHOUT ANY WARRANTY; without even the implied warranty of
    #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    #GNU General Public License for more details.
    
    #You should have received a copy of the GNU General Public License
    #along with this program.
    
    #######################################################################
    
    #Must be run as root
    #This script will remove all logs and traces from a host.
    
    #######################################################################
    
    if [ $(id -u) != "0" ]; then
        echo "You must be root to run this script"
        exit 1
    fi
    
    #######################################################################
    
    if [ updatedb ]; then
        echo "Updating database with mlocate please wait"
        sleep 2
        updatedb
    else
        echo "mlocate package not installed"
        echo "mlocate package must be installed to update database...continuing anyway"
        sleep 5
    fi
    
    #######################################################################
    
    if [ -d /var/lib/logrotate ]; then
            echo "________________________________________________________________________________________________"
            echo "This host has logrotate installed...displaying logrotate config file"
            sleep 2
            cat /etc/logrotate.conf
            sleep 5
            echo "Displaying output of..."
            cd /etc/logrotate.d
            pwd
            sleep 2
            ls
            sleep 1
            
    else
            echo "Good news, this host does not have logrotate installed"
    fi
    
    ########################################################################
    
    echo "Checking for log servers...running arp"
    
    sleep 4
    
    if [ arp ]; then
        arp
        echo "________________________________________________________________________________________________"
        echo "See anything?..."
        sleep 10
        echo "Proceeding with deleting logs press CTRL + C to cancel. Beginning countdown..."
        sleep 1
        echo "9"
        sleep 1
        echo "8"
        sleep 1
        echo "7"
        sleep 1
        echo "6"
        sleep 1
        echo "5"
        sleep 1
        echo "4"
        sleep 1
        echo "3"
        sleep 1
        echo "2"
        sleep 1
        echo "1"
        sleep 1
        echo "Proceeding with deletion..."
    
    else
    
        echo "The host needs the arp package installed to look for other hosts on the network"
        echo "It is recommended to install arp before proceeding"
        sleep 10
    
    fi
    
    #######################################################################
    
    if [ -d /root/.bash_history ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /root/.bash_history"
        cd /root/.bash_history
        rm *
    else
        echo "/root/.bash_history wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /root/.bash_logout ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /root/.bash_logout"
        cd /root/.bash_logout
        rm *
    else
        echo "/root/.bash_logout wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /root/.ksh_history ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /root/.ksh_history"
        cd /root/.ksh_history
        rm *
    else
        echo "/root/.ksh_history wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /etc/utmp ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /etc/utmp"
        cd /etc/utmp
        rm *
    else
        echo "/etc/utmp wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /etc/wtmp ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /etc/wtmp"
        cd /etc/wtmp
        rm *
    else
        echo "/etc/wtmp wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /tmp/logs ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /tmp/logs"
        cd /tmp/logs
        rm *
    else
        echo "/tmp/logs wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /usr/local/apache/logs ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /usr/local/apache/log"
        cd /usr/local/apache/log
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service apache2 restart
        sleep 5
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
        sleep 5
    else
        echo "/usr/local/apache/log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/adm ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/adm"
        cd /var/adm
        rm *
    else
        echo "/var/adm wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/apache/log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/apache/log"
        cd /var/apache/log
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service apache2 restart
        sleep 5
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
        sleep 5
    else
        echo "/var/apache/log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/Xorg.x.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/Xorg.x.log"
        cd /var/log/
        rm Xorg.x.log
    else
        echo "Xorg.x.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/alternatives.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/alternatives.log"
        cd /var/log/
        rm alternatives.log
    else
        echo "alternatives.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/anaconda.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/anaconda.log"
        cd /var/log/
        rm anaconda.log
        echo "This host was installed using anaconda. Chances are its RedHat,
        CentOS, Fedora...Running uname -a"
        sleep 5
        uname -a
        sleep 5
    else
        echo "anaconda.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/apache2 ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/apache2"
        cd /var/log/apache2
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service apache2 restart
        sleep 5
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
        sleep 5
    else
        echo "/var/log/apache2 wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/httpd ]; then
        echo "________________________________________________________________________________________________"
        echo "Host has httpd package might be Fedora / Red Hat based"
        echo "Deleting /var/log/httpd"
        cd /var/log/httpd
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service httpd restart
        sleep 5
        echo "httpd / Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
        sleep 5
    else
        echo "/var/log/apache2 wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/apt ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/apt"
        cd /var/log/apt
        rm *
        sleep 3
        echo "This host uses apt : Chances are its Debian based"
        sleep 3
        echo "Running uname -a"
        sleep 3
        uname -a
        sleep 5
    else
        echo "/var/log/apt wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/auth.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/auth.log"
        cd /var/log/
        rm auth.log
    else
        echo "/var/log/auth.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/boot.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/boot.log"
        cd /var/log/
        rm boot.log
    else
        echo "/var/log/boot.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/btmp ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/btmp"
        cd /var/log/
        rm btmp
    else
        echo "btmp wasn't found so not deleted"
    fi
    
    
    #######################################################################
    
    if [ -d /var/log/cron ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/cron"
        cd /var/log/cron
        rm *
    else
        echo "/var/log/cron wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/cups ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/cups"
        cd /var/log/cups
        rm *
    else
        echo "/var/log/cups wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/daemon.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/daemon.log"
        cd /var/log/
        rm daemon.log
    else
        echo "/var/log/daemon.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/dbconfig-common ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/dbconfig-common"
        cd /var/log/dbconfig-common
        rm *
    else
        echo "/var/log/dbconfig-common wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/dmesg ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/dmesg"
        cd /var/log/
        rm dmesg
    else
        echo "dmesg wasn't found so not deleted
        However it might be in syslog."
        sleep 5
        echo "Displaying syslog in 3 seconds"
        sleep 3
        cat syslog
        sleep 4
    
    fi
    
    #######################################################################
    
    if [ -f /var/log/dpkg.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/dpkg.log"
        cd /var/log
        rm dpkg.log
        echo "This host uses dpkg chances are its Debian based"
        sleep 5
    else
        echo "/var/log/dpkg.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/exim4 ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/exim4"
        cd /var/log/exim4
        rm *
    else
        echo "/var/log/exim4 wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/firebird ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/firebird"
        cd /var/log/firebird
        rm *
    else
        echo "/var/log/firebird wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/gdm3 ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/gdm3"
        cd /var/log/gdm3
        rm *
    else
        echo "/var/log/gdm3 wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/kern.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/kern.log"
        cd /var/log
        rm kern.log
        echo "This host had a kern.log file. This log is useful for hosts 
        running custom-built kernels. Running uname -a"
        sleep 3
        uname -a
        sleep 5
    else
        echo "/var/log/kern.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d var/log/lastlog ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/lastlog"
        cd /var/log/lastlog
        rm *
    else
        echo "var/log/lastlog wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/lightdm ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/lightdm"
        cd /var/log/lightdm
        rm *
    else
        echo "/var/log/lightdm wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/lighttpd ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/lighttpd.log"
        cd /var/log/lighttpd
        rm *
    else
        echo "/var/log/lighttpd wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/mail.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/mail.log"
        cd /var/log/
        rm mail.log
    else
        echo "var/log/mail.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/maillog ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/maillog"
        cd /var/log/maillog
        rm *
    else
        echo "var/log/maillog wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/messages ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/messages"
        cd /var/log
        rm messages
    else
        echo "/var/log/messages wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/samba ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/samba"
        cd /var/log/samba
        rm *
        echo "This host had samba, there might be Windows hosts on the network"
        sleep 3
        echo "Re-Running arp"
        sleep 1 
        arp
    else
        echo "/var/log/samba wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/log/secure ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/secure"
        cd /var/log/secure
        rm *
    else
        echo "/var/log/secure wasn't found so not deleted"
    fi
    
    
    #######################################################################
    
    if [ -d /var/log/setroubleshoot ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/setroubleshoot"
        cd /var/log/setroubleshoot
        rm *
    else
        echo "/var/log/setroubleshoot wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/user.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/user.log"
        cd /var/log/
        rm user.log
    else
        echo "/var/log/user.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/vsftpd.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/vsftpd.log"
        cd /var/log/
        rm vsftpd.log
        echo "You might want to restart the vsftpd service, this can cause issues for people using the FTP service however"
        sleep 5
    else
        echo "/var/log/vsftpd.log wasn't found so not deleted"
    fi
    
    
    #######################################################################
    
    if [ -d /var/log/wtmp ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/wtmp"
        cd /var/log/wtmp
        rm *
    else
        echo "/var/log/wtmp wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -f /var/log/yum.log ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/log/yum.log"
        cd /var/log/
        rm yum.log
        echo "This host is using Yellowdog Update manager a.k.a yum 
        Chances are its RedHat, CentOS, Fedora...Running uname -a"
        sleep 5
        uname -a
        sleep 5
    else
        echo "/var/log/yum.log wasn't found so not deleted"
    fi
    
    #######################################################################
    
    if [ -d /var/run/utmp ]; then
        echo "________________________________________________________________________________________________"
        echo "Deleting /var/run/utmp"
        cd /var/run/utmp
        rm *
    else
        echo "/var/run/utmp wasn't found so not deleted"
    fi
    
    #######################################################################
    
    
     
  2. Morpheus696

    Morpheus696 Registered Member

    Joined:
    Apr 11, 2016
    Messages:
    94
    Likes Received:
    41
    Gender:
    Male
    Occupation:
    I do stuff, people pay me.
    Location:
    /dev/null
    What you need help with?

    Btw the original version is deprecated please use this version instead.

    Code:
    #!/bin/bash
    
    #######################################################################
    
    #This program is free software: you can redistribute it and/or modify
    #it under the terms of the GNU General Public License as published by
    #the Free Software Foundation, either version 3 of the License, or
    #(at your option) any later version.
    
    #This program is distributed in the hope that it will be useful,
    #but WITHOUT ANY WARRANTY; without even the implied warranty of
    #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    #GNU General Public License for more details.
    
    #You should have received a copy of the GNU General Public License
    
    #######################################################################
    
    #Must be run as root
    #This script will remove all logs and traces from a host.
    
    #######################################################################
    
    if [ $(id -u) != "0" ]; then
        echo "You must be root to run this script"
        exit 1
    fi
    
    #######################################################################
    
    if [ updatedb ]; then
        echo "Updating database with mlocate please wait"
        updatedb
    else
        echo "mlocate package not installed"
    fi
    
    ########################################################################
    
    echo "Running arp..."
    
    if [ arp ]; then
        echo "_______________________________________________________________________________________________"
        arp
        echo "_______________________________________________________________________________________________"
    else
    
    fi
    
    #######################################################################
    
    if [ -d /tmp/logs ]; then
        echo "Deleting /tmp/logs"
        cd /tmp/logs
        rm *
    fi
    
    #######################################################################
    
    if [ -d /root/.bash_history ]; then
        echo "Deleting /root/.bash_history"
        cd /root/.bash_history
        rm *
    fi
    
    #######################################################################
    
    if [ -f /root/.ksh_history ]; then
        echo "Deleting /root/.ksh_history"
        cd /root/.ksh_history
        rm *
    fi
    
    #######################################################################
    
    if [ -f /root/.bash_logout ]; then
        echo "Deleting /root/.bash_logout"
        cd /root/.bash_logout
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/lighttpd ]; then
        echo "Deleting /var/log/lighttpd.log"
        cd /var/log/lighttpd
        rm *
    fi
    
    #######################################################################
    
    if [ -f /usr/local/apache/logs ]; then
        echo "Deleting /usr/local/apache/logs"
        cd /usr/local/apache/logs
        rm *
        echo "Restarting the Apache2 Service"
        service apache2 restart
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
    fi
    
    #######################################################################
    
    if [ -d /usr/local/apache/logs ]; then
        echo "Deleting /usr/local/apache/log"
        cd /usr/local/apache/log
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service apache2 restart
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
    fi
    
    #######################################################################
    
    if [ -d /var/log/apache2 ]; then
        echo "Deleting /var/log/apache2"
        cd /var/log/apache2
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service apache2 restart
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
        echo "________________________________________________________________________________________________"
    fi
    
    #######################################################################
    
    if [ -d /var/apache/log ]; then
        echo "Deleting /var/apache/log"
        cd /var/apache/log
        rm *
        echo "Restarting the Apache2 Service, please wait..."
        service apache2 restart
        echo "Apache2 Status"
        echo "________________________________________________________________________________________________"
        service apache2 status
        echo "________________________________________________________________________________________________"
    fi
    
    #######################################################################
    
    if [ -d /var/run/utmp ]; then
        echo "Deleting /var/run/utmp"
        cd /var/run/utmp
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/adm ]; then
        echo "Deleting /var/adm"
        cd /var/adm
        rm *
    fi
    
    #######################################################################
    
    if [ -d /etc/wtmp ]; then
        echo "Deleting /etc/wtmp"
        cd /etc/wtmp
        rm *
    fi
    
    #######################################################################
    
    if [ -d /etc/utmp ]; then
        echo "Deleting /etc/utmp"
        cd /etc/utmp
        rm *
    fi
    
    #######################################################################
    
    if [ -d var/log/lastlog ]; then
        echo "Deleting var/log/lastlog"
        cd /var/log/lastlog
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/wtmp ]; then
        echo "Deleting /var/log/wtmp"
        cd /var/log/wtmp
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/apt ]; then
        echo "Deleting /var/log/apt"
        cd /var/log/apt
        rm *
        sleep 1
        echo ""
        echo "Running uname -a"
        echo ""
        sleep 1
        uname -a
        sleep 1
    fi
    
    #######################################################################
    
    if [ -d /var/log/cups ]; then
        echo "Deleting /var/log/cups"
        cd /var/log/cups
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/dbconfig-common ]; then
        echo "Deleting /var/log/dbconfig-common"
        cd /var/log/dbconfig-common
        rm *
    fi
    
    #######################################################################
    
    if [ -f /var/log/daemon.log ]; then
        echo "Deleting /var/log/daemon.log"
        cd /var/log/
        rm daemon.log
    fi
    
    #######################################################################
    
    if [ -d /var/log/exim4 ]; then
        echo "Deleting /var/log/exim4"
        cd /var/log/exim4
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/firebird ]; then
        echo "Deleting /var/log/firebird"
        cd /var/log/firebird
        rm *
    fi
    
    #######################################################################
    
    if [ -f /var/log/kern.log ]; then
        echo "Deleting /var/log/kern.log "
        cd /var/log/
        rm kern.log 
    fi
    
    #######################################################################
    
    if [ -d /var/log/lightdm ]; then
        echo "Deleting /var/log/lightdm"
        cd /var/log/lightdm
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/gdm3 ]; then
        echo "Deleting /var/log/gdm3"
        cd /var/log/gdm3
        rm *
    fi
    
    #######################################################################
    
    if [ -f /var/log/auth.log ]; then
        echo "Deleting /var/log/auth.log"
        cd /var/log/
        rm auth.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/boot.log ]; then
        echo "Deleting /var/log/boot.log"
        cd /var/log/
        rm boot.log
    fi
    
    #######################################################################
    
    if [ -d /var/log/messages ]; then
        echo "Deleting /var/log/messages"
        cd /var/log/messages
        rm *
    fi
    
    #######################################################################
    
    if [ -f /var/log/dmesg ]; then
        echo "Deleting /var/log/dmesg"
        cd /var/log/
        rm dmesg
    fi
    
    #######################################################################
    
    if [ -f /var/log/dpkg.log ]; then
        echo "Deleting /var/log/dpkg.log"
        cd /var/log
        rm dpkg.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/kern.log ]; then
        echo "Deleting /var/log/kern.log"
        cd /var/log
        rm kern.log
    fi
    
    #######################################################################
    
    if [ -d /var/log/maillog ]; then
        echo "Deleting /var/log/maillog"
        cd /var/log/maillog
        rm *
    fi
    
    #######################################################################
    
    if [ -f /var/log/mail.log ]; then
        echo "Deleting /var/log/mail.log"
        cd /var/log/
        rm mail.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/user.log ]; then
        echo "Deleting /var/log/user.log"
        cd /var/log/
        rm user.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/user.log ]; then
        echo "Deleting /var/log/user.log"
        cd /var/log/
        rm user.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/Xorg.x.log ]; then
        echo "Deleting /var/log/Xorg.x.log"
        cd /var/log/
        rm Xorg.x.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/alternatives.log ]; then
        echo "Deleting /var/log/alternatives.log"
        cd /var/log/
        rm alternatives.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/btmp ]; then
        echo "Deleting /var/log/btmp"
        cd /var/log/
        rm btmp
    fi
    
    #######################################################################
    
    if [ -f /var/log/anaconda.log ]; then
        echo "Deleting /var/log/anaconda.log"
        cd /var/log/
        rm anaconda.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/yum.log ]; then
        echo "Deleting /var/log/yum.log"
        cd /var/log/
        rm yum.log
    fi
    
    #######################################################################
    
    if [ -f /var/log/dnf.log ]; then
        echo "Deleting /var/log/dnf.log"
        cd /var/log/
        rm dnf.log*
    fi
    
    #######################################################################
    
    
    if [ -d /var/log/cron ]; then
        echo "Deleting /var/log/cron"
        cd /var/log/cron
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/secure ]; then
        echo "Deleting /var/log/secure"
        cd /var/log/secure
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/faillog ]; then
        echo "Deleting /var/log/faillog"
        cd /var/log/faillog
        rm *
    fi
    
    #######################################################################
    
    if [ -f /var/log/vsftpd.log ]; then
        echo "Deleting /var/log/vsftpd.log"
        cd /var/log/vsftpd.log
        rm *
        echo "Restarting vsftpd service..."
        service vsftpd restart
        service vsftpd status
        sleep 1
    fi
    
    #######################################################################
    
    if [ -d /var/log/setroubleshoot ]; then
        echo "Deleting /var/log/setroubleshoot"
        cd /var/log/setroubleshoot
        rm *
    fi
    
    #######################################################################
    
    if [ -d /var/log/samba ]; then
        echo "Deleting /var/log/samba"
        cd /var/log/samba
        rm *
    fi
    
    #######################################################################