From owner-freebsd-current@freebsd.org Fri Aug 21 15:20:29 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D18C39BF5DF for ; Fri, 21 Aug 2015 15:20:29 +0000 (UTC) (envelope-from ohartman@zedat.fu-berlin.de) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F47861E for ; Fri, 21 Aug 2015 15:20:29 +0000 (UTC) (envelope-from ohartman@zedat.fu-berlin.de) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.85) for freebsd-current@freebsd.org with esmtp (envelope-from ) id <1ZSo7H-00095T-Ig>; Fri, 21 Aug 2015 17:20:27 +0200 Received: from p578a69f9.dip0.t-ipconnect.de ([87.138.105.249] helo=freyja.zeit4.iv.bundesimmobilien.de) by inpost2.zedat.fu-berlin.de (Exim 4.85) for freebsd-current@freebsd.org with esmtpsa (envelope-from ) id <1ZSo7H-0009xM-7p>; Fri, 21 Aug 2015 17:20:27 +0200 Date: Fri, 21 Aug 2015 17:20:26 +0200 From: "O. Hartmann" To: freebsd-current Subject: cron/python3: python script acts weird, no debug output Message-ID: <20150821172026.27b65c40@freyja.zeit4.iv.bundesimmobilien.de> Organization: FU Berlin X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: 87.138.105.249 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 15:20:30 -0000 I put this in this list, hopefully to find an answer. Using a setup of NanoBSD as the platform for a small application written in Python 3.4, which is supposed to run via cron and with UID of a special user, I run into very nasty "non responsivnes" behaviour of the cron application. The setup is simple, using NanoBSD built from CURRENT: 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r286948: Thu Aug 20 05:50:45 CEST 2015 amd64 and double-checked setting of the OS running from an USB flash drive, / is r/w, enough space left et cetera. I managed to install packe lang/python3 and all of its dependencies as compiled with the same base system as NanoBSD is built from - so from hereof no problems should arise. The python3 script comprises from several files, main.py and some files with subroutines, all located in the same directory (~/bin) of a certain user's home. The script looks for files on a memory files system backed folder/drive and moves them, if any, towards a smbfs share provided by a M$ 2012R2 server, mounted via autofs. So far, no problem. Login as the specified user and running the script via "python3 bin/main.py" works like a charme. That specific user has an existing /var/cron/allow entry and the /var/cron/tabs/user_foo file with the cronjob description exists, too. So far, no irregularity. When the job is run from cron, the situation changes dramatically. The setup is like this: SHELL=/bin/sh TZ=Europe/Berlin MAILTO="" PATH=/usr/local/bin:/usr/local/sbin:${PATH} */1 * * * * /usr/local/bin/python3 /home/user_foo/bin/main.py --src /mfs/src \ -dst /mnt/server_slot I tried also other variants, having in mind that cron has a very limited inheritage of the environment, like */1 * * * * cd /hom,e/user/foo/bin && /usr/local/bin/python3 main.py --src /mfs/src \ -dst /mnt/server_slot so the python3 script may find its pieces. But whenever the cronjob starts, I see the first messages as output from the script, some jumps into subroutines (I use classes from os, sys), but then, suddenly, the output dies. Simply dies. this happens then when the job seems to find files it should move. this is indicated by the fact that I printout Start (time): End (time): but END: (time) then never is seen on console or syslog (I delegate everything with prio debug to console and a syslog server). It looks like the python3 job suffers from severe lack in resources and isn't capable of even send out some agony messages. I'm floating like a dead man in the water and the rare hairs got more gray coloured over the past days finding a solution. maybe I'm missing something with cron/python3? Hopefully someone finds the simple answer I'm seeking. regards, Oliver