CronTab Common Errors and crontab Common Errors

Source: Internet
Author: User
Tags bit set

CronTab Common Errors and crontab Common Errors

Environment Variable


When using environment variables, crontab may fail to normally access the environment variables in bashrc.

Therefore, you should be very careful when using crontab to access environment variables.


Between the third and fifth are "or" operations ("date" and "Week ")


Run a. sh at 07:30 on the first Sunday of June 17, May.

30 7 1-7 5 0 a. sh // incorrect usage, will be executed multiple times
30 7 1-7 5 * test'date + \ % w-eq 0 &&~ A. sh // extract the week of the current date and determine whether it is 0. a slash is used before %.
Use test to Judge 1 = 0, test1-eq 0, for example, test.
Minutes
Executed every two hours
 0*/2 * * * a.sh
 
 
How to Use test
 (EXPRESSION )
              EXPRESSIONis true
 
       !EXPRESSION
              EXPRESSIONis false
 
       EXPRESSION1-a EXPRESSION2
              bothEXPRESSION1 and EXPRESSION2 are true
 
       EXPRESSION1-o EXPRESSION2
              eitherEXPRESSION1 or EXPRESSION2 is true
 
       -nSTRING
              thelength of STRING is nonzero
 
       STRINGequivalent to -n STRING
 
       -zSTRING
              thelength of STRING is zero
 
       STRING1= STRING2
              thestrings are equal
 
       STRING1!= STRING2
              thestrings are not equal
 
       INTEGER1-eq INTEGER2
              INTEGER1is equal to INTEGER2
 
       INTEGER1-ge INTEGER2
              INTEGER1is greater than or equal to INTEGER2
 
       INTEGER1-gt INTEGER2
              INTEGER1is greater than INTEGER2
 
       INTEGER1-le INTEGER2
              INTEGER1is less than or equal to INTEGER2
 
       INTEGER1-lt INTEGER2
              INTEGER1is less than INTEGER2
 
       INTEGER1-ne INTEGER2
              INTEGER1is not equal to INTEGER2
 
       FILE1-ef FILE2
              FILE1and FILE2 have the same device and inode numbers
 
       FILE1-nt FILE2
              FILE1is newer (modification date) than FILE2
 
       FILE1-ot FILE2
              FILE1is older than FILE2
 
       -bFILE
              FILEexists and is block special
 
       -cFILE
              FILEexists and is character special
 
       -dFILE
              FILEexists and is a directory
 
       -eFILE
              FILEexists
 
       -fFILE
              FILEexists and is a regular file
 
       -gFILE
              FILEexists and is set-group-ID
 
       -GFILE
              FILEexists and is owned by the effective group ID
 
       -hFILE
              FILEexists and is a symbolic link (same as -L)
 
       -kFILE
              FILEexists and has its sticky bit set
 
       -LFILE
              FILEexists and is a symbolic link (same as -h)
 
       -OFILE
              FILEexists and is owned by the effective user ID
 
       -pFILE
              FILEexists and is a named pipe
 
       -rFILE
              FILEexists and read permission is granted
 
       -sFILE
              FILEexists and has a size greater than zero
 
       -SFILE
              FILEexists and is a socket
 
       -tFD  file descriptor FD is opened on a terminal
 
       -uFILE
              FILEexists and its set-user-ID bit is set
 
       -wFILE
              FILEexists and write permission is granted
 
       -xFILE
              FILEexists and execute (or search) permission is granted
 





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.