Shell controls the number of running times (based on the date) many people worry that due to time issues or misoperations, the script runs multiple times (especially data operations ). Therefore, it is necessary to add some control. Similarly, if you need to control the number of times, you can add the number field. The following is an example of how to modify it according to the running scenario. Update () {date_d = 'date "+ % Y-% m-% d" 'echo "$ date_d"> run_fileecho "update complete, write the date to the run_file file (marked as running on a single day) "} run_check () {if [-f run_file]; then run_date = 'awk' END {print $0} 'run_file 'if [$ run_date = $ date_d]; then echo "$ date_d has been run once, exit "exit 0 else echo" $ date_d without running records. Call update to run "update fi else update fi} main () {run_check} main