On Dec 4, 12:34 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
In message [EMAIL PROTECTED], Philip
Semanchuk wrote:
In my experience, the environment in which a cron job runs is
different from the environment in which some command line scripts run...
Which is
In message
[EMAIL PROTECTED], Astley
Le Jasper wrote:
On Dec 4, 12:34 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
For example, here are some headers from a recent run of the
maildir backup task I have scheduled twice a day:
Subject: Cron [EMAIL PROTECTED]
On Dec 4, 2008, at 4:21 AM, Astley Le Jasper wrote:
On Dec 4, 12:34 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
In message [EMAIL PROTECTED],
Philip
Semanchuk wrote:
In my experience, the environment in which a cron job runs is
different from the environment
Ok ... this is odd.
I tried gregory's suggestion of redirecting the stdout stderr to a
text file. This worked. I could see all the logging information.
However, there was no error to see this time ... the application
worked completely without any problems.
I also then tried Jon's suggestion of
In message
[EMAIL PROTECTED], Astley
Le Jasper wrote:
The trouble is that obviously I get no console when using crontab so
can't see any traceback.
Cron normally sends you mail if a cron task generated any output (this
should include error messages).
--
I've included a switch to include or exclude the logging to console.
When logging only to file, the script runs fine.
Of course, I still don't understand why dual logging, and specifically
to the console, causes a problem and if anyone has any comments about
the dual output logging code above
On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote:
I've included a switch to include or exclude the logging to console.
When logging only to file, the script runs fine.
Of course, I still don't understand why dual logging, and specifically
to the console, causes a problem and if anyone has
On 3 Dec, 16:41, Philip Semanchuk [EMAIL PROTECTED] wrote:
On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote:
I've included a switch to include or exclude theloggingto console.
Whenloggingonly to file, the script runs fine.
Of course, I still don't understand whyduallogging, and
On Dec 3, 2008, at 1:33 PM, Astley Le Jasper wrote:
On 3 Dec, 16:41, Philip Semanchuk [EMAIL PROTECTED] wrote:
On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote:
I've included a switch to include or exclude theloggingto console.
Whenloggingonly to file, the script runs fine.
Of course,
On 3 Dec, 19:49, Philip Semanchuk [EMAIL PROTECTED] wrote:
On Dec 3, 2008, at 1:33 PM, Astley Le Jasper wrote:
On 3 Dec, 16:41, Philip Semanchuk [EMAIL PROTECTED] wrote:
On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote:
I've included a switch to include or exclude theloggingto
On Dec 3, 2008, at 3:06 PM, Astley Le Jasper wrote:
On 3 Dec, 19:49, Philip Semanchuk [EMAIL PROTECTED] wrote:
On Dec 3, 2008, at 1:33 PM, Astley Le Jasper wrote:
On 3 Dec, 16:41, Philip Semanchuk [EMAIL PROTECTED] wrote:
On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote:
I've
In message [EMAIL PROTECTED], Philip
Semanchuk wrote:
In my experience, the environment in which a cron job runs is
different from the environment in which some command line scripts run...
Which is true, but again, cron should report the environment in the mail
message. For example, here are
I need help ... I've been looking at this every evening for over a
week now. I'd like to see my kids again!
I have script that runs fine in the terminal but when I try to run it
in a crontab for either myself or root, it bails out.
The trouble is that obviously I get no console when using
Put your main function in a big
try, except. Catch any and all
errors and log them. Example:
def main():
try:
do_something()
except Exception, error:
log(ERROR: %s % error)
log(format_exc())
Hope this helps.
cheers
James
On Wed, Dec 3, 2008 at 12:35 AM, Astley Le Jasper
On Dec 2, 2008, at 9:35 AM, Astley Le Jasper wrote:
I need help ... I've been looking at this every evening for over a
week now. I'd like to see my kids again!
I have script that runs fine in the terminal but when I try to run it
in a crontab for either myself or root, it bails out.
The
James ... thanks for the suggestion. I have done this and the error
logging usually catches all my errors and logs them. I wondered if
logging itself was failing!
Philip ... thanks also. I did wonder about making the everything
explicit. I've seen that mentioned elsewhere. Writing out the stdout
use UNIX mail command: crontab will send letters to you and you can
look at traceback there.
--
http://mail.python.org/mailman/listinfo/python-list
Try using the following at the begining of your Python program:
import sys
sys.stdout = open(out.txt,w)
sys.stderr = open(err.txt,w)
Then whatever would normally go to stdout or stderr goes to text files
instead. You will see everything that happened.
--
Astley Le Jasper wrote:
my crontab is:
30 15 * * * cd /home/myusername/src python myscript.py
I create a file runmyscript.sh and put it in /usr/bin
#!/bin/bash
cd /home/myusername.src
python /path/to/myscript
then chmod a+x /usr/bin/runmyscript.sh
test it
./runmyscript
add it to the
On Dec 2, 2:35 pm, Astley Le Jasper [EMAIL PROTECTED] wrote:
...
Try using the screen utility - change the line in your crontab:
cd /home/myusername/src python myscript.py
to
cd /home/myusername/src screen -dmS mypthon python -i myscript.py
then once cron has started your program attach to the
20 matches
Mail list logo