Today I checked a scheduled bash script which is used to clear temp files regularly through the crontab, but found that these files still exist, they’re not removed, this means that the bash script hasn’t been executed correctly.
Then I logged into the server as root, and run that script as root from the command line, it’s not executed too, that’s very wired!
On Stackoverflow.com, some users said that if you have mounted the file system with the “noexec” option, then the scripts will not run. But, another script on the same file system was executed without problem!
After a few attempts, changed the permission of the .sh file, changed its owner, still doesn’t work!
Finally I decided to create a new file with the nano text editor, and copy all lines from the old file into the new one, this time IT DOES WORK!
The reason is that, the original script file was created by UltraEdit on Windows, and uploaded to the server. The new script file was created on CentOS, although they have the same content, the file sizes of them are different.
BTW, the title of this post was capitalized with an online app, I don’t need to press the shift key to type the first letters of each words in the title anymore! This online app is http://wordcount.cc/