* */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
网友评论