FTPlib-operation: why some downloads, but others not?

In question, the Python scripts needed to create boot files from JSON-Call , the resulting python script using ftplib loads the json file and xml file. This script runs on Python on raspberries and calls Domoticz.

Since the application required the download of two more sets of files, I repeated the exact same setup for the other 4 files in the script, planning that downloading json files would be possible, but initially only 3 xml files should be downloaded.

Then, the "boot partition" includes 6 lines, as shown below.

#upload(ftp, "json87_upload.json")
upload(ftp, "xml87_upload.xml")
#upload(ftp, "json88_upload.json")
upload(ftp, "xml88_upload.xml")
#upload(ftp, "json462_upload.json")
upload(ftp, "xml462_upload.xml")

All 6 downloaded files are in the same source folder, and the destination folder is identical for all 6 files.

The initial manual check of the script (without #) from the Putty command line led to the desired download of all 6 files with a clear indication (along the print line in the script) that the script was completed. After this test, the script is now part of the cronjob PythonRuntime01.sh for periodic execution as the first command line.

#!/bin/bash
sudo python /home/pi/domoticz/scripts/python/URL_JSON_XML_Upload03esp8266a.py
sudo python /home/pi/domoticz/scripts/python/URL_JSON_XML_Upload01esp8266c_all.py

Cronjob periodically runs crontab:

*/5 * * * * /home/pi/domoticz/scripts/PythonRuntime01.sh 2>&1 >> /dev/null

But as part of cronjob, the execution of the script is not as expected.

If I take all # in the script, then only the first 4 lines will lead to loading.

If I put # as shown, then the first 4 lines of the script will create the load, not the last two lines.

" " , ( ). cronjob, script, script . crontab . .

: Python- script 4 , ? # -es.

10 2017 .

- , cronjob crontab, . () sh , cronjob.

;-( . -, cron .........

17 2017 :

(crontab ). , , .

Syslog :

 Aug 17 09:20:01 raspberrypi CRON[1454]: (root) CMD (/home/pi/domoticz/scripts/PythonRuntime01.sh 2>&1 >> /dev/null)
 Aug 17 09:20:01 raspberrypi CRON[1447]: (CRON) info (No MTA installed, discarding output)

, crontab

 */5 * * * * /home/pi/domoticz/scripts/PythonRuntime01.sh 2>&1

Syslog , :

 Aug 17 14:10:01 raspberrypi CRON[1325]: (root) CMD (/home/pi/domoticz/scripts/PythonRuntime01.sh 2>&1)
 Aug 17 14:10:05 raspberrypi CRON[1318]: (CRON) info (No MTA installed, discarding output)

, Raspberry, crontab, sh , Syslog , "" . , crontab .

 Aug 17 14:32:01 raspberrypi CRON[14474]: (pi) CMD (/home/pi/domoticz/scripts/DDS238Export01.sh 2>&1 /dev/null)
 Aug 17 14:32:05 raspberrypi CRON[14467]: (CRON) info (No MTA installed, discarding output)

sh , 755 rwx-

-, , .

0

Source: https://habr.com/ru/post/1712312/


All Articles