I have the following code in my crontab :-

0-59/1    *    *    *    *    root **applications/welcome/cron/test.py

and the following code in my test.py which are inside the cron folder in my
application :-

db.person.insert(name="Alex")

and i want to insert this into the table person which are defined in the
model db.py :-

db.define_table('person', Field('name'))

so please help me through this example how automatically insert/update the
data in database by using cron job.


On Tue, Feb 28, 2012 at 5:10 PM, Sanjeet Kumar <sanjeet....@gmail.com>wrote:

> Thanks Luciano i will try.
>
>
> On Tue, Feb 28, 2012 at 5:06 PM, Luciano Pacheco <lucm...@gmail.com>wrote:
>
>> I have written to you how to do that.
>>
>> Copy and paste:
>>
>> , but, in the example file, do this changes:
>>
>> # file: applications/instore/modules/background_updater.py
>>
>> from applications.instore.controllers.default import index
>>
>> # instead of time.sleep(5), inside the function main()
>>     index()
>>
>> On Tue, Feb 28, 2012 at 10:33 PM, Sanjeet Kumar <sanjeet....@gmail.com>wrote:
>>
>>> Yes I want to run the index function of my default controller in a cron
>>> is this possible or not ?
>>>
>>> On Tue, Feb 28, 2012 at 4:58 PM, Luciano Pacheco <lucm...@gmail.com>wrote:
>>>
>>>> You want to run the index function of your controller in a cron ?
>>>>
>>>> Usually it doesn't make sense, but, in the example file
>>>>
>>>> # file: applications/instore/modules/background_updater.py
>>>>
>>>> from applications.instore.controllers.default import index
>>>>
>>>> # instead of time.sleep(5), inside the function main()
>>>>     index()
>>>>
>>>> I alson didn't understand what you want, if this doesn't solve your
>>>> question, try explain your use case.
>>>>
>>>> Regards,
>>>>
>>>>
>>>> On Tue, Feb 28, 2012 at 10:00 PM, Sanjeet Kumar 
>>>> <sanjeet....@gmail.com>wrote:
>>>>
>>>>> I am not be able to get you properly can you give me the better
>>>>> clarification i have the default controller and the index function can you
>>>>> tell me how can i run the index function by using crontab which are in my
>>>>> application folder.
>>>>>
>>>>>
>>>>> On Tue, Feb 28, 2012 at 4:12 PM, Luciano Pacheco <lucm...@gmail.com>wrote:
>>>>>
>>>>>> Following the same example.
>>>>>>
>>>>>> In you controller:
>>>>>>
>>>>>> from applications.instore.modules.background_updater main
>>>>>>
>>>>>> def force_background_updater():
>>>>>>     ret = main()
>>>>>>      return 'The result was: %s' % ret
>>>>>>
>>>>>> But, the cron is run time based tasks, usually those tasks won't be
>>>>>> used in controller.One exception is when you want to force a task to run.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>>
>>>>>> On Tue, Feb 28, 2012 at 9:11 PM, Sanjeet Kumar <sanjeet....@gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> i tried this but i am not be able to run my controller Can you give
>>>>>>> me the simple example through which i can run the function written under
>>>>>>> the controller inside my application
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Feb 27, 2012 at 5:39 PM, Luciano Pacheco 
>>>>>>> <lucm...@gmail.com>wrote:
>>>>>>>
>>>>>>>> Example:
>>>>>>>>
>>>>>>>> http://movu.ca/demo/article/show/31/web2py-cron-task
>>>>>>>>
>>>>>>>> My first try in movu.ca :-)
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Feb 27, 2012 at 2:32 PM, Sanjeet Kumar <
>>>>>>>> sanjeet....@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Exactly I need the examples
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Feb 27, 2012 at 4:56 AM, Luciano Pacheco <
>>>>>>>>> lucm...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> I think Sanjeet means, I example of the task.
>>>>>>>>>>
>>>>>>>>>> What is a good practice in the task, or what kind of variables
>>>>>>>>>> are present in the local namespace "automagically", etc. A task 
>>>>>>>>>> should be a
>>>>>>>>>> class a function, a python module?
>>>>>>>>>>
>>>>>>>>>> I had the same question last week when I was reading this
>>>>>>>>>> chapter. :-)
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> --
>>>>>>>>>> Luciano Pacheco
>>>>>>>>>> blog.lucmult.com.br
>>>>>>>>>>
>>>>>>>>>> On Mon, Feb 27, 2012 at 10:08 AM, Alan Etkin 
>>>>>>>>>> <spame...@gmail.com>wrote:
>>>>>>>>>>
>>>>>>>>>>> It's all in the book (if you haven't seen yet)
>>>>>>>>>>>
>>>>>>>>>>> http://web2py.com/books/default/chapter/29/4#Cron
>>>>>>>>>>>
>>>>>>>>>>> By the way, The link in web2py to cron (http://web2py.com/books/
>>>>>>>>>>> default/reference/29/cron<http://web2py.com/books/default/reference/29/cron>)
>>>>>>>>>>> is broken (returns an invalid function
>>>>>>>>>>> message)
>>>>>>>>>>>
>>>>>>>>>>> On 26 feb, 13:09, Sanjeet Kumar <sanjeet....@gmail.com> wrote:
>>>>>>>>>>> > Can anyone give me the brief description to how I set the cron
>>>>>>>>>>> to run the
>>>>>>>>>>> > task in background with example.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Luciano Pacheco
>>>>>>>> blog.lucmult.com.br
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Luciano Pacheco
>>>>>> blog.lucmult.com.br
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Luciano Pacheco
>>>> blog.lucmult.com.br
>>>>
>>>
>>>
>>
>>
>> --
>> Luciano Pacheco
>> blog.lucmult.com.br
>>
>
>

Reply via email to