I'm executing a python script via cron job. The way it is set up is, I'm editing a file called local[ inside /etc/cron.d/.The local file content is as follows:
When this job executes, the command-specific logfile and the syslog (where the logs are supposed to go) show half of the logs(no errors) and the command (and also the child cron) gets terminated in the midway(checked it with ps -ef | grep su and same way for the child cron) without deleting the lock files(which it is normally supposed to do even on an abnormal termination).
I browsed for this issue and found the suspect might be the way stdout(print in python) is handled in cron! To confirm, i just executed another python script that logs to logfile and also prints to console. It gave me the same failure.
But if I change the content of the local file to
it works just fine. The process completes gracefully with all the cleanup actions done and logs updated.
But i still do not understand so clearly what was exactly the issue, can someone explain if it is known to you? And also the MAILTO field in /etc/crontab file is empty ("").I'm hoping this is the default path where we get the cron logs as mails . Will it help to solve this if i change this filed? (pls let me know what to populate this with)
Sadly that didn't work. The user field seems to be compulsory.
But I found something here. In my python script, the python module used for writing into syslog and console is the "logger" module. I noticed that most of the scripts that uses this are showing the behaviour mentioned above. But the scripts that use python "syslog" modules for the same works all fine. I'm trying to make out the exact difference between these but meanwhile, Just wanted to know if I'm in the right direction to investigate the issue. So if anyone is aware if this might cause such issues, pls comment.
Hi,
1)
If some job supposed to run on 1st of every month at 7 AM
In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day?
2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct)
And if 25th... (5 Replies)
Hi ,
I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility )
I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Hi Gurus,
I have a test unix server in which currently some unix cronjob are running.
I have written two script one is a shell script in which env variable are there (in that i am exporting those variables).
I have also written a perl script .
when i am running at the shell manually like... (5 Replies)
I need to add 10 records to database from a file /tmp/authlist.log(contains insert into table sql commands)
When i execute the following script manually its executing and working fine.
the same is not getting executed when i try to execute using crontab
vi /tmp/test1.sh
#!/bin/sh... (4 Replies)
Hi All,
I have scheduled a script in cron which writes output to the below file.
....>> /data/Target/wrapper_invoke_ds_job_`date '+%Y%m%d'`.ksh_out 2>&1
But the date command is not getting resolved in the format specified. It just resolves to the following.
wrapper_invoke_MQ_ds_job_Tue... (3 Replies)
Hi all,
I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so.
0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log
The checkstatus.sh scripts looks like this.
... (4 Replies)
I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Hi everyone:
I'm trying to make a CRON job that will execute Fridays at 7am. I have the following:
* 7 * * 5
I've been studying up on CRON and I know to have this in a file and then "crontab filename.txt" to add it to the CRON job list.
The CRON part I believe I understand, but I would... (6 Replies)