Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
If I check de cron log, everything apperas to be fine
# grep CRON /var/log/syslo
Dec 21 00:15:01 srv-debian CRON[5263]: (root) CMD (/usr/local/bin/python3.8 /dados/python_script/1.Rotinas_Automatizadas/Alertas/BI.py)
Dec 21 00:15:02 srv-debian CRON[5262]: (CRON) info (No MTA installed, discarding output)
If I execute manually this command , works fine too.
def insertError():
string = ""
sql = """SELECT v.ID, v.BLOCO, to_char(v.DT_HR_INICIO, 'DD/MM/YYYY HH24:MI:SS'), to_char(v.DT_HR_FIM, 'DD/MM/YYYY HH24:MI:SS'),
v.PARAMETRO, v.STATUS, v.OBS
FROM VM_DETALHES v where id not in(select id from aux_log)
and v.STATUS NOT IN ('ATUALIZANDO','FINALIZADO')"""
cursorF.execute(sql)
dataError = cursorF.fetchall()
if len(dataError) != 0:
for i in range(0,len(dataError)):
cursorF.execute(f"INSERT INTO AUX_LOG VALUES ({dataError[0]}, sysdate)")
string += "<p> ID: "+ str(dataError[0])+ "</p>" + "<p> PROCEDURE: "+str(dataError[1]) + "<p/> <p>" + "DATA/HORA: "+str(dataError[3]) + "</p> <p>" + "ERRO: " +str(dataError[6])+"</p> ====================================================="
lucas = Mail("EMAIL@DOMINIO.com.br","Log de atualização do BI", string)
lucas.send_mail()
guilherme = Mail("EMAIL2@DOMINIO.com.br","Log de atualização do BI", string)
guilherme.send_mail()
fumacense.commit()
I also had a problem with starting a python script, in my case it was at startup. I discovered that the workdirectory of my script was my home directory, not the path of the python script
My solution was to set the workdirectory as first command in the script. In your case this would be:
os.chdir("/usr/local/bin/python3.8 /dados/python_script")
Perhaps this works for you also.
There is a trailing space in that path name at folder "python3.8 ". This should not be there.
Your python script is full of syntax errors due to missing indentation. It may be a copy-paste error, but we can only work with what you provide us with here. Your script, as you provided it to us, is utterly broken.
"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank
# grep CRON /var/log/syslog
Dec 21 00:15:01 srv-debian CRON[5263]: (root) CMD (/usr/local/bin/python3.8 /dados/python_script/1.Rotinas_Automatizadas/Alertas/BI.py)
Dec 21 00:15:02 srv-debian CRON[5262]: (CRON) info (No MTA installed, discarding output)
This just say that you job has been run (with or without errors). Errors from cron jobs are not logged to syslog but mail. Since there is no MTA on your system, you should add you own log to debug:
I notice your python script has a shebang in it.
If the file were an executable (chmod +x) you could just start it as such (./BI.py) without the need to provide python3.8 on the cli or in your croj.