How to solve the shell script stop execution when the Linux system is scheduled?

  
                

When the Linux system is performing scheduled tasks, the shell script suddenly stops executing. Many users are unclear. So what caused the shell to not execute? In fact, the reason is very simple, the following small series will introduce you to the Linux timing task shell script to stop the implementation of the solution.

The reason is that the timing of the task is no environment variable, import environment variables in your shell script, import environment variables

In the uppermost shell script solution

export PATH=$PATH:/bin:/usr/bin:/usr/local/bin

Example:

Executing /bin/every 0th hour of every month Ls :

0 * * * * /bin/ls

During the month of December, every day from 6 am to 12 am, /usr/bin/backup is executed every 20 minutes. :

*/20 6-12 * 12 * /usr/bin/backup

Send a letter to [email protected] every Monday to Friday at 5:00 pm:

0 17 * * 1-5 mail -s “hi” [email protected] /tmp/maildata

Everyday at midnight every day at 0:20, 2:20, 4 Point 20 points. . . . Execute echo “haha”

20 0-23/2 * * * echo “haha”

If you stop the shell script during scheduled tasks, then most of the shell scripts are not imported Environment variables can be added to the relevant code described in this article.

Copyright © Windows knowledge All Rights Reserved