Re: [web2py] Re: Cron doesn't work for me...
Hi VP! How did you use the system cron? I'm wondering how can I specify the function that I want to execute... Regards, Tito On Tue, Mar 15, 2011 at 1:53 AM, VP vtp2...@gmail.com wrote: Cron didn't work for me either, so I used the system cron. One question I have though is why root when web2py is run as www- data? -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: Cron doesn't work for me...
I answered your email. Briefly (on Linux/Unix): + Use crontab -l to see your cron entries. + Use crontab -e to create/edit cron entries. + Google / wikipedia for cron syntax. To execute a URL (e.g. web2py controller, you can either use wget or curl). On Mar 15, 8:05 am, Tito Garrido titogarr...@gmail.com wrote: Hi VP! How did you use the system cron? I'm wondering how can I specify the function that I want to execute... Regards, Tito On Tue, Mar 15, 2011 at 1:53 AM, VP vtp2...@gmail.com wrote: Cron didn't work for me either, so I used the system cron. One question I have though is why root when web2py is run as www- data? -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
Re: [web2py] Re: Cron doesn't work for me...
Thanks! On Tue, Mar 15, 2011 at 1:06 PM, VP vtp2...@gmail.com wrote: I answered your email. Briefly (on Linux/Unix): + Use crontab -l to see your cron entries. + Use crontab -e to create/edit cron entries. + Google / wikipedia for cron syntax. To execute a URL (e.g. web2py controller, you can either use wget or curl). On Mar 15, 8:05 am, Tito Garrido titogarr...@gmail.com wrote: Hi VP! How did you use the system cron? I'm wondering how can I specify the function that I want to execute... Regards, Tito On Tue, Mar 15, 2011 at 1:53 AM, VP vtp2...@gmail.com wrote: Cron didn't work for me either, so I used the system cron. One question I have though is why root when web2py is run as www- data? -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: Cron doesn't work for me...
In fact, seems that it doesn't work on webfaction... On Mon, Mar 14, 2011 at 9:15 PM, Tito Garrido titogarr...@gmail.com wrote: Not sure why but cron never worked for me... 0-59/1 * * * * root *admin/test def test(): mail.send('titogarr...@gmail.com','test','teste') return 'test' Nothing happens... I've tried locally and on webfaction... What I am doing wrong? Also how can I use external cron? I couln't figure out where I can specify the controler function on the book example: 0-59/1 * * * * web2py cd /var/www/web2py/ python web2py.py -C -D 1 /tmp/cron.output 21 Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: Cron doesn't work for me...
I think 0-59/1 * * * * root *admin/test should be 0-59/1 * * * * root *admin/default/test there may be other problems. On Mar 14, 7:15 pm, Tito Garrido titogarr...@gmail.com wrote: Not sure why but cron never worked for me... 0-59/1 * * * * root *admin/test def test(): mail.send('titogarr...@gmail.com','test','teste') return 'test' Nothing happens... I've tried locally and on webfaction... What I am doing wrong? Also how can I use external cron? I couln't figure out where I can specify the controler function on the book example: 0-59/1 * * * * web2py cd /var/www/web2py/ python web2py.py -C -D 1 /tmp/cron.output 21 Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: Cron doesn't work for me...
Cron didn't work for me either, so I used the system cron. One question I have though is why root when web2py is run as www- data?
[web2py] Re: Cron doesn't work for me...
The user is irrelevant. The value is not used. On Mar 14, 11:53 pm, VP vtp2...@gmail.com wrote: Cron didn't work for me either, so I used the system cron. One question I have though is why root when web2py is run as www- data?
[web2py] Re: cron doesn't work
Yes, it's work fine manually, if I call it in a browser. And yes, I'v restarted web2py many times ;) On 18 фев, 04:46, pbreit pbreitenb...@gmail.com wrote: Ah, ok. Looks like it is probably following a route. Sorry about that. So if you just call the function in a browser it works fine? But the cron doesn't seem to trigger the function? I assume you've restarted web2py?
[web2py] Re: cron doesn't work
Yes, it's work fine manually. And yes, I restarted web2py many times ;) On 18 фев, 04:46, pbreit pbreitenb...@gmail.com wrote: Ah, ok. Looks like it is probably following a route. Sorry about that. So if you just call the function in a browser it works fine? But the cron doesn't seem to trigger the function? I assume you've restarted web2py?
[web2py] Re: cron doesn't work
I tried the same on my cron (just working on it) and it looks like it doesn't run when web2py is run in wsgi under Apache2. When I start it with python web2py works w/o a problem. Strange. B. On 17 feb., 08:24, LightOfMooN vladsale...@yandex.ru wrote: How to check, is the cron working? If i start web2py with command line: python web2py.py, Cron runs my function once, and after minute prints error: cannot allocate memory On 16 фев, 20:19, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: cron doesn't work
Have somebody know any solution for this problem? On 17 фев, 13:08, b0j3 boje...@gmail.com wrote: I tried the same on my cron (just working on it) and it looks like it doesn't run when web2py is run in wsgi under Apache2. When I start it with python web2py works w/o a problem. Strange. B. On 17 feb., 08:24, LightOfMooN vladsale...@yandex.ru wrote: How to check, is the cron working? If i start web2py with command line: python web2py.py, Cron runs my function once, and after minute prints error: cannot allocate memory On 16 фев, 20:19, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: cron doesn't work
According to my understanding of web2py book you should use hard coded cron, which means the system one. On 17 feb., 12:03, LightOfMooN vladsale...@yandex.ru wrote: Have somebody know any solution for this problem? On 17 фев, 13:08, b0j3 boje...@gmail.com wrote: I tried the same on my cron (just working on it) and it looks like it doesn't run when web2py is run in wsgi under Apache2. When I start it with python web2py works w/o a problem. Strange. B. On 17 feb., 08:24, LightOfMooN vladsale...@yandex.ru wrote: How to check, is the cron working? If i start web2py with command line: python web2py.py, Cron runs my function once, and after minute prints error: cannot allocate memory On 16 фев, 20:19, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: cron doesn't work
if apache manages start and stop of web2py threads you cannot use cron inside apache. This does not mean you cannot use web2py cron. You just have to start a web2py instance manually: nohup web2py.py -i 127.0.0.1 -p 8000 On Feb 16, 9:19 am, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: cron doesn't work
nohup web2py.py -i 127.0.0.1 -p 8000 raises error: nohup: cannot run comand 'web2py.py': No such file or directory. ofc, I try to run it in web2py catalog. On 17 фев, 19:29, Massimo Di Pierro massimo.dipie...@gmail.com wrote: if apache manages start and stop of web2py threads you cannot use cron inside apache. This does not mean you cannot use web2py cron. You just have to start a web2py instance manually: nohup web2py.py -i 127.0.0.1 -p 8000 On Feb 16, 9:19 am, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: cron doesn't work
cd wherever web2py is then try this: sudo -u www-data nohup python web2py.py -i 127.0.0.1 -p 8000 On Feb 17, 9:29 am, LightOfMooN vladsale...@yandex.ru wrote: nohup web2py.py -i 127.0.0.1 -p 8000 raises error: nohup: cannot run comand 'web2py.py': No such file or directory. ofc, I try to run it in web2py catalog. On 17 фев, 19:29, Massimo Di Pierro massimo.dipie...@gmail.com wrote: if apache manages start and stop of web2py threads you cannot use cron inside apache. This does not mean you cannot use web2py cron. You just have to start a web2py instance manually: nohup web2py.py -i 127.0.0.1 -p 8000 On Feb 16, 9:19 am, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
Re: [web2py] Re: cron doesn't work
On Feb 17, 2011, at 7:29 AM, LightOfMooN wrote: nohup web2py.py -i 127.0.0.1 -p 8000 raises error: nohup: cannot run comand 'web2py.py': No such file or directory. ofc, I try to run it in web2py catalog. Try either: nohup ./web2py.py ... or: python web2py.py ... On 17 фев, 19:29, Massimo Di Pierro massimo.dipie...@gmail.com wrote: if apache manages start and stop of web2py threads you cannot use cron inside apache. This does not mean you cannot use web2py cron. You just have to start a web2py instance manually: nohup web2py.py -i 127.0.0.1 -p 8000 On Feb 16, 9:19 am, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: cron doesn't work
if it runs with python web2py.py -i 127.0.0.1 -p 8000 it works fine at once, and after minute: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory If it runs with sudo -u www-data nohup python web2py.py -i 127.0.0.1 -p 8000 or nohup ./web2py.py it also works fine once, and not even more. There is error in nohup.out: web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.92.1 (2011-02-16 15:04:40) Database drivers available: SQLite3, pymysql, PostgreSQL Starting hardcron... choose a password:Traceback (most recent call last): File web2py.py, line 19, in module gluon.widget.start(cron=True) File /home/www-data/web2py/gluon/widget.py, line 860, in start options.password = raw_input('choose a password:') IOError: [Errno 9] Bad file descriptor so I tried to run it with -a mypassword and have again the same error in nohup.out: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory
[web2py] Re: cron doesn't work
How much memory do you have? can you check with top memory consumption? Do you cron jobs take long time? On Feb 17, 10:45 am, LightOfMooN vladsale...@yandex.ru wrote: if it runs with python web2py.py -i 127.0.0.1 -p 8000 it works fine at once, and after minute: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory If it runs with sudo -u www-data nohup python web2py.py -i 127.0.0.1 -p 8000 or nohup ./web2py.py it also works fine once, and not even more. There is error in nohup.out: web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.92.1 (2011-02-16 15:04:40) Database drivers available: SQLite3, pymysql, PostgreSQL Starting hardcron... choose a password:Traceback (most recent call last): File web2py.py, line 19, in module gluon.widget.start(cron=True) File /home/www-data/web2py/gluon/widget.py, line 860, in start options.password = raw_input('choose a password:') IOError: [Errno 9] Bad file descriptor so I tried to run it with -a mypassword and have again the same error in nohup.out: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory
Re: [web2py] Re: cron doesn't work
On Feb 17, 2011, at 11:24 AM, Massimo Di Pierro wrote: How much memory do you have? can you check with top memory consumption? Do you cron jobs take long time? Could be a recursion problem, too. On Feb 17, 10:45 am, LightOfMooN vladsale...@yandex.ru wrote: if it runs with python web2py.py -i 127.0.0.1 -p 8000 it works fine at once, and after minute: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory If it runs with sudo -u www-data nohup python web2py.py -i 127.0.0.1 -p 8000 or nohup ./web2py.py it also works fine once, and not even more. There is error in nohup.out: web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.92.1 (2011-02-16 15:04:40) Database drivers available: SQLite3, pymysql, PostgreSQL Starting hardcron... choose a password:Traceback (most recent call last): File web2py.py, line 19, in module gluon.widget.start(cron=True) File /home/www-data/web2py/gluon/widget.py, line 860, in start options.password = raw_input('choose a password:') IOError: [Errno 9] Bad file descriptor so I tried to run it with -a mypassword and have again the same error in nohup.out: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory
[web2py] Re: cron doesn't work
I have VDS with 256mb, and all is used Seems it's too low. On 18 фев, 00:24, Massimo Di Pierro massimo.dipie...@gmail.com wrote: How much memory do you have? can you check with top memory consumption? Do you cron jobs take long time? On Feb 17, 10:45 am, LightOfMooN vladsale...@yandex.ru wrote: if it runs with python web2py.py -i 127.0.0.1 -p 8000 it works fine at once, and after minute: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory If it runs with sudo -u www-data nohup python web2py.py -i 127.0.0.1 -p 8000 or nohup ./web2py.py it also works fine once, and not even more. There is error in nohup.out: web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.92.1 (2011-02-16 15:04:40) Database drivers available: SQLite3, pymysql, PostgreSQL Starting hardcron... choose a password:Traceback (most recent call last): File web2py.py, line 19, in module gluon.widget.start(cron=True) File /home/www-data/web2py/gluon/widget.py, line 860, in start options.password = raw_input('choose a password:') IOError: [Errno 9] Bad file descriptor so I tried to run it with -a mypassword and have again the same error in nohup.out: Exception in thread Thread-15: Traceback (most recent call last): File /usr/lib/python2.6/threading.py, line 532, in __bootstrap_inner self.run() File /home/www-data/web2py/gluon/newcron.py, line 220, in run shell=self.shell) File /usr/lib/python2.6/subprocess.py, line 633, in __init__ errread, errwrite) File /usr/lib/python2.6/subprocess.py, line 1049, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory
[web2py] Re: cron doesn't work
I would suggest doing something simple to at least confirm that it is working OK. For example, updating a timestamp in your database every n minutes.
[web2py] Re: cron doesn't work
function is very simple. Just updates 1 row per every minute: def test(): shop = db(db.shops.id==1).select().first() shop.update_record(deletedate=request.now) db.commit() return 'done' On 18 фев, 00:56, pbreit pbreitenb...@gmail.com wrote: I would suggest doing something simple to at least confirm that it is working OK. For example, updating a timestamp in your database every n minutes.
[web2py] Re: cron doesn't work
Try putting in a more complete path such as: *applications/myapp/cron/test
[web2py] Re: cron doesn't work
It doesn't work. If I write in crontab: */1 * * * * root *applications/rushops/cron/test It rises an error: Invalid application name: rushops/applications/rushops/cron/test On 18 фев, 02:08, pbreit pbreitenb...@gmail.com wrote: Try putting in a more complete path such as: *applications/myapp/cron/test
[web2py] Re: cron doesn't work
Ah, ok. Looks like it is probably following a route. Sorry about that. So if you just call the function in a browser it works fine? But the cron doesn't seem to trigger the function? I assume you've restarted web2py?
[web2py] Re: cron doesn't work
How to check, is the cron working? If i start web2py with command line: python web2py.py, Cron runs my function once, and after minute prints error: cannot allocate memory On 16 фев, 20:19, LightOfMooN vladsale...@yandex.ru wrote: Hello I have web2py installed with setup-web2py-ubuntu.sh It runs with Apache mod_wsgi. Crontab of myapp is: */1 * * * * root *cron/test And function: def test(): shop = db(db.shops.id==8).select().first() new = shop.daystodelete + 1 shop.update_record(daystodelete=new) db.commit() return 'done' test() manually function works fine. But not with cron. Seems it's not working. Any ideas? Thx
[web2py] Re: CRON doesn't work
Hi Sverre, I have the exact same issue. (Running web2py 1.87.3) Did you manage to get to work? / jonas On Nov 4, 11:10 am, Sverre sverreodeg...@gmail.com wrote: My cron tab looking like this #crontab */2 * * * * root *sys/test_cron @hourly root *applications/mm/cron/expire_sessions.py but this doesn' work. My test cron function is from time import ctime def test_cron(): db.dbg.insert(dbgmsg=ctime()) db.commit() return ready If I trigger this function manually it's working. Web2Py is installed as a Windows Service. Is someone able to help?
[web2py] Re: CRON doesn't work
Please try the web2py nighlty built. On Nov 10, 3:48 pm, Jonas Rundberg jo...@rundberg.com wrote: Hi Sverre, I have the exact same issue. (Running web2py 1.87.3) Did you manage to get to work? / jonas On Nov 4, 11:10 am, Sverre sverreodeg...@gmail.com wrote: My cron tab looking like this #crontab */2 * * * * root *sys/test_cron @hourly root *applications/mm/cron/expire_sessions.py but this doesn' work. My test cron function is from time import ctime def test_cron(): db.dbg.insert(dbgmsg=ctime()) db.commit() return ready If I trigger this function manually it's working. Web2Py is installed as a Windows Service. Is someone able to help?
[web2py] Re: CRON doesn't work
You can have a function but the script must call it: from time import ctime def test_cron(): db.dbg.insert(dbgmsg=ctime()) db.commit() return ready test_cron() # On Nov 4, 10:24 am, Vinicius Assef vinicius...@gmail.com wrote: Sverre, I think you must use your own application crontab, located at applications/your_app/cron I suggest you create a python script without any functions inside it, to isolate your cron job, and put it in applications/your_app/private/. I do this here and it works nice. Following my advice, your crontab would be like it: */2 * * * * root *applications/your_app/private/test_cron.py And your test_cron.py will have no def inside it. -- Vinicius Assef. On Thu, Nov 4, 2010 at 8:10 AM, Sverre sverreodeg...@gmail.com wrote: My cron tab looking like this #crontab */2 * * * * root *sys/test_cron @hourly root *applications/mm/cron/expire_sessions.py but this doesn' work. My test cron function is from time import ctime def test_cron(): db.dbg.insert(dbgmsg=ctime()) db.commit() return ready If I trigger this function manually it's working. Web2Py is installed as a Windows Service. Is someone able to help?