[Labs-l] Cron jobs can't connect to the database

Andre Karwath aka at aka-online.de
Fri Jun 27 10:26:05 UTC 2014


Hi,

I tried it. If I run it from a login shell, it works. If a cron job 
starts it, it fails with

Traceback (most recent call last):
   File "test.py", line 19, in <module>
     main()
   File "test.py", line 10, in main
     db = MySQLdb.connect(db="enwiki_p", host="enwiki.labsdb", read_default_file=os.path.expanduser("~/replica.my.cnf"))
   File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
     return Connection(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
     super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'enwiki.labsdb' (110)")


Regards,
    André (aka)



Am 27.06.2014 12:12, schrieb John:
> Can you try and run https://dpaste.de/O2jg its a python script. If it 
> throws an error send that back too.
>
> Thanks
>
> On Fri, Jun 27, 2014 at 5:38 AM, Andre Karwath <aka at aka-online.de 
> <mailto:aka at aka-online.de>> wrote:
>
>     Hi,
>
>     I just migrated a tool from the toolserver to labs. It works as
>     long as I ran it from a shell, but it gets no database connection
>     if I start it as cronjob.
>
>     I put a small example script to http://pastebin.com/hSnhee8U
>     I already tried to use an absolute path to the .cnf file, but this
>     did not solve the problem.
>
>     Any ideas?
>
>     Regards,
>        André (aka)
>
>     -- 
>     André Karwath, Dipl. Inf.
>     aka at aka-online.de  <mailto:aka at aka-online.de>
>
>
>     _______________________________________________
>     Labs-l mailing list
>     Labs-l at lists.wikimedia.org <mailto:Labs-l at lists.wikimedia.org>
>     https://lists.wikimedia.org/mailman/listinfo/labs-l
>
>
>
>
> _______________________________________________
> Labs-l mailing list
> Labs-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/labs-l


-- 
André Karwath, Dipl. Inf.
aka at aka-online.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/labs-l/attachments/20140627/b7f80ea3/attachment-0001.html>


More information about the Labs-l mailing list