Linux Command - CRON
Linux CRON 命令
CREATE A CRON SCRIPT TO CLEAN
Edit the /opt/daily-clean.sh file
#!/bin/bash
# docker
docker system prune -f
docker builder prune -f
docker volume prune -f
# /home/puaiuc/
find /home/puaiuc/ -maxdepth 1 -type f \( -iname "*" ! -iname ".*" \) -delete
Now give the file executable permission
chmod a+x /opt/daily-clean.sh
Edit the crontab file to schedule it
crontab -e
In our case, we have scheduled it to every day at the start of the day
0 1 * * * sh /opt/daily-clean.sh