Hello Bob,

Thank you for the BIG tip.

i did not answer before because i went out on travel.

thank you once again,

edson

Em quarta-feira, 30 de maio de 2012 17h01min34s UTC-1, Bob Sleys escreveu:
>
> What you need is a job to run to calculate the parcels each day, week, 
> month, whatever time period you need.  This job needs to run say once a day 
> and find all accounts that owe parcels and decrease the amount that is 
> owed.  Sorry I don't quite understand your parcels and charging system but 
> it's pretty obviousness you need a job to run every x time frame, do a 
> calculation and save those changes to the database.  Ruby and rails has no 
> default built in scheduling of jobs to be run at specific time frames but 
> all operating systems have a job scheduler. in linux the most common OS 
> ruby on rails apps are run uses cron to schedule and run jobs. So its a 
> natural fit to schedule your job to do that calculations.  The next 
> questions is what should it execute or run.  Rails has rake tasks.  These 
> tasks are the same ones you use to migrate the database, build a default 
> app etc.  You can write your own tasks. Here is one of many tutorials on 
> rake tasks  http://jasonseifer.com/2010/04/06/rake-tutorial .  So to 
> solve your problems I'd personally write a rake task that could be run once 
> a day that found all accounts that needed to be charged parcels, do the 
> calculation and make any database changes and use a cron task to run that 
> rake task each day at a specific time.  I'd probably also write a simple 
> shell script to monitor the first cron job and rake task to make sure 
> everything is working as it should and notify me via an e-mail if something 
> is wrong, say the task didn't run or encountered an error.  I'd than setup 
> a second cron job to run a bit after the first one to run the shell script. 
>  Basically a simple monitoring routine so if something goes wrong I'd get 
> an e-mail letting me know.
>
> Bob
>
> On Wednesday, May 30, 2012 12:48:45 PM UTC-4, Edson wrote:
>>
>> I'm sorry Bob, but is that msg for me ?
>>
>> If yes i didn't understand.
>>
>> Thank You,
>>
>> Edson 
>>
>> Em quarta-feira, 30 de maio de 2012 11h05min54s UTC-1, Bob Sleys escreveu:
>>>
>>> I'd look into a rake task that could be run via cron job.  Just make 
>>> sure the rake task can handle things properly if for some reason the cron 
>>> job doesn't run for some reason.  IE I'd set up the cron job to run once a 
>>> day and have it run the rake task and log the results. If the cron job 
>>> doesn't run for some reason you need the rake task to be able to catch up 
>>> and get things in balance again.  You could also setup a 2nd cron job to 
>>> monitor the first one by looking at the log file.  The 2nd job would e-mail 
>>> you if anything went wrong with the first one. ie errors in the log or even 
>>> nothing in the log as in it didn't run at all.
>>>
>>> Bob
>>>
>>> On Wednesday, May 30, 2012 7:57:26 AM UTC-4, Edson wrote:
>>>>
>>>> Hi folks,
>>>>
>>>> What's the best approach i must have to design a system where i have an 
>>>> bank account and loans. The loans must be charged by parcels. For 
>>>> example: if i give some credit to a person (1000 USD) then i want to 
>>>> charge him 10 parcels, 1 per month in 10 month. So i need i way to 
>>>> Decrease the parcels as they are being paid.
>>>>
>>>> Could someone give me a tip on this approach ?
>>>>
>>>> Thank You all,
>>>>
>>>> Edson
>>>>  
>>>

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/hobousers/-/1x3T-I7rUBAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to