Summary of shell script execution problems

I recently started learning shell scripts and encountered some problems . The summary is as follows: 1.

The written shell script is manually executed ok, but once it is added to the crontab, it cannot be executed . : PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin 2. There are paths that reference other files in the file (relative paths are used) Solution: use absolute paths (sometimes The relative path is OK, but sometimes not, this is very strange, and the reason has not been found yet) The solution to this problem is to add an error output log to the crontab timing, which will record detailed error information For example : 0 2 * * * * root /bin /bash /led/data.sh > /var/log/dm_monitor_kestrel.log 2>&1&
















Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326557270&siteId=291194637