美文网首页
shell常规操作

shell常规操作

作者: 与狼共舞666 | 来源:发表于2023-01-29 16:27 被阅读0次
image.png
* */2 * * * ntpdate cn.ntp.org.cn;clock -w
0 0 * * * find /data/tmp -mtime  +7 | xargs rm -rf
route add -net 192.168.100.0/24 gw 192.168.99.2
1\. Create a script file, such as /usr/local/bin/check_nginx.sh, with the following 
content: #!/bin/bash status=$(systemctl status nginx | grep Active | awk '{print $2}') if [ "$status" != "active" ]; then systemctl restart nginx fi 
2\. Add a cron job to execute the script every 30 minutes: */30 * * * * /usr/local/bin/check_nginx.sh

on the Linux host:# Set the system global umask to 002 echo "umask 002" >> /etc/profile

0 * * * * grep -rn "ERROR" /var/log/* > /var/log/error.log

1. Install nginx on the Linux host.
2. Create a configuration file for nginx, such as /etc/nginx/conf.d/proxy.conf.
3. Add the following content to the configuration file:
    server {
        listen 9000;
        location / {
            proxy_pass http://192.168.99.101:19200;
        }
    }
4. Restart nginx service.
5. Test the proxy configuration.
1. Create a script file, such as /usr/local/bin/backup_db.sh, with the following content:
    #!/bin/bash
    mysqldump -u username -p password test > /data/backup/test_$(date +%!Y(MISSING)%!m(MISSING)%!d(MISSING)).sql
2. Add a cron job to execute the script every night:
    0 0 * * * /usr/local/bin/backup_db.sh
3. Add a cron job to delete the backup 7 days ago:
    0 0 * * * find /data/backup/ -mtime +7 -type f -exec rm {} \;
1. Create a script file, such as /usr/local/bin/delete_tmp.sh, with the following content:
    #!/bin/bash
    find /data/tmp -mtime +7 -type f -exec rm {} \;
2. Add a cron job to execute the script every night at 0:00:
    0 0 * * * /usr/local/bin/delete_tmp.sh

相关文章

  • shell常规操作

    on the Linux host:# Set the system global umask to 002 ec...

  • 终端adb命令获取应用版本号及版本名称信息

    网上搜索如何通过终端命令获取应用版本号,常规操作步骤 1、通过pm获取应用安装位置 adb shell pm pa...

  • 01-Linux入门基础:命令行BASH的基本操作

    1.1命令行BASH的基本操作 1.1.1 shell shell又叫壳,shell是操作系统内核和操作者(用户)...

  • HBase数据操作

    1、 HBase shell操作 在命令行中执行hbase shell就进入了hbase shell操作模式,可以...

  • Shell学习笔记-基础学习

    什么是shell? shell是外壳的意思,就是操作系统的外壳。 我们可以通过shell命令来操作和控制操作系统,...

  • 常规操作

    2018-08-30 第一件事。服务器上的一个ip突然就访问不到了。本机ping了一下没通,返回的是另一个ip给的...

  • 常规操作

    对于大多数人来说,就是清理衣橱和更新服装这样简单的改变也是如此艰难。很多人出去购买新衣服,但样式没有更新。 For...

  • 常规操作

    从阳台看 楼下测核酸的队伍 成了一条弯曲且盘旋的长蛇 工作不是每天必做的 排队是每天的常规操作

  • Shell脚本的简单介绍

    什么是Shell Shell应该是命令解释器,将Shell脚本解析成操作系统能理解的操作去执行。Shell脚本就是...

  • 使用shell脚本

    使用方式 shell 变量 shell 字符串操作 shell 数组 shell 注释 shell 命令行参数 s...

网友评论

      本文标题:shell常规操作

      本文链接:https://www.haomeiwen.com/subject/phrphdtx.html