Skip to content

codecho/shell_tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

这是一个shell脚本仓库,里面有很多实用的功能

功能列表

  • 禁止恶意ip登录
  • 定时清除nacos产生的日志
  • 通过一行脚本命令切换JDK版本

deny_illegal_ip.sh

  • backup hosts.deny

    cp /etc/hosts.deny /etc/hosts.deny.bak
  • create illegal_ip file

    touch /xxx/illegal_ip_list.txt
  • create cron_task log file

    touch /xxx/cron/task.log
  • create cron task, execute the script every 30 minutes

    crontab -e
    
    */30 * * * * /xxx/deny_illegal_ip.sh

clean_nacos_logs.sh

  • replace $LOG_PATH and $ONE_MONTH_AGO_SECONDS in shell
    LOG_PATH="/usr/nacos/bin/logs"
    ONE_MONTH_AGO_SECONDS=`date -d "30 day ago" "+%s"`
  • create cron task, execute the script every day
    crontab -e
    
    0 0 * * * /usr/shell_study/clean_nacos_logs.sh

switch_jdk.sh

  • replace $my_versions
    # here are jdk versions you installed
    my_versions=([8]="/usr/java/jdk" [17]="/usr/java/jdk17")
  • execute the script with target jdk version
    source switch_jdk.sh version
    or
    . switch_jdk.sh version

About

deny illegal ip with unauthorized access in linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages