Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Fri Dec 06, 2019 3:08 pm
VoIP Billing solution


All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Cron Job
PostPosted: Sun Dec 09, 2007 5:42 pm 
Offline

Joined: Thu Sep 13, 2007 12:46 pm
Posts: 254
Location: Naples, Fl ( USA )
Hi
I have question because Ijust do not know.
crontjobs how do I set it up. I do not think that a2billing setup the crontab to call the cronjob I would like someone to help me out to setup crontab to do thejobs in the cronjobs diretory.
thanks and advance.


Top
 Profile  
 
 Post subject: Need help on that subject
PostPosted: Tue Dec 11, 2007 2:33 am 
Offline

Joined: Thu Sep 13, 2007 12:46 pm
Posts: 254
Location: Naples, Fl ( USA )
I know it my be a basic question but the reason that I am asking that question is because the subcription monthly invoices are not working. the invoice are not automatically created. I set up packages and they are not working. I look at the crontab and did not see anything that look like a2billing since I have no clue how cront is supose to work in linux and I am not an expert in linux I am asking for help on that subject.

thanks


Top
 Profile  
 
 Post subject: I got the answer
PostPosted: Tue Dec 11, 2007 10:18 pm 
Offline

Joined: Thu Sep 13, 2007 12:46 pm
Posts: 254
Location: Naples, Fl ( USA )
I found out how to do it.
thanks anyway


Top
 Profile  
 
 Post subject: Re: I got the answer
PostPosted: Mon Feb 25, 2008 11:13 pm 
Offline

Joined: Thu Feb 14, 2008 1:14 pm
Posts: 10
graher01 wrote:
I found out how to do it.
thanks anyway


How did you get it to work?


Top
 Profile  
 
 Post subject: Re: I got the answer
PostPosted: Tue Feb 26, 2008 1:51 am 
Offline

Joined: Thu Sep 13, 2007 12:46 pm
Posts: 254
Location: Naples, Fl ( USA )
vientorio wrote:
graher01 wrote:
I found out how to do it.
thanks anyway


How did you get it to work?


My problem was that I had no clue about linux. what I did is that.
from the console I did
su asterisk
then crontab -e
0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_alarm.php
0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_alarm.php
0 12 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_batch_process.php
0 2 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_bill_diduse.php
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_check_account.php
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_invoice_cront.php
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_subscription_fee.php
0 6 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/currencies_update_yahoo.php

and voila it works

I also have to thank stavos who did not tell me what to do but gave me a hint.


Top
 Profile  
 
 Post subject: I can't make it work
PostPosted: Wed May 21, 2008 11:32 am 
Offline

Joined: Mon Dec 03, 2007 5:50 pm
Posts: 26
this is what I get when I run one of the cron jobs as explained by you.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pgsql' - /usr/lib/php/modules/pgsql: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pcntl.so' - /usr/lib/php/modules/pcntl.so: cannot open shared object file: No such file or directory in Unknown on line 0

any idea what I am doing wrong?

Thanks


Top
 Profile  
 
 Post subject: Re: I can't make it work
PostPosted: Wed May 21, 2008 12:18 pm 
Offline

Joined: Thu Sep 13, 2007 12:46 pm
Posts: 254
Location: Naples, Fl ( USA )
tommaso wrote:
this is what I get when I run one of the cron jobs as explained by you.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pgsql' - /usr/lib/php/modules/pgsql: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pcntl.so' - /usr/lib/php/modules/pcntl.so: cannot open shared object file: No such file or directory in Unknown on line 0

any idea what I am doing wrong?

Thanks


make sure the crontab is set in asterisk
do this
su asterisk
then crontab -e
then paste the code.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 21, 2008 1:22 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
I don't think Graher01's advice is pertinent to your problem.

PHP's pcntl and pgsql extensions aren't installed on your system, or aren't functioning correctly when called by PHP from the command line. Verify this with 'php -m'. The lack of pcntl will be causing many calls not to be billed correctly.
You'd be best consulting your distribution for help installing these PHP modules.
Are you using Postgres or MySQL for the A2Billing database?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 7:19 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Yes


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 6:55 pm 
Offline
Moderator
User avatar

Joined: Tue Jun 06, 2006 12:14 pm
Posts: 685
Location: florida
You can also set them in WebMin if you like. I went there to tweak up the time frames that I was using.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 01, 2008 9:32 pm 
Offline
Moderator
User avatar

Joined: Tue Jun 06, 2006 12:14 pm
Posts: 685
Location: florida
In webmin, on the cronjob, you found them, did you try "run now" - you can then make sure #1 that it runs properly, and #2 how it performs. Read the job and you can see where log files are written and then check the log to see what its doing.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2008 10:10 pm 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
I have read this thread throughly.

I will generate the invoices every 25 of each month, every customer will be charged $ 0.50 for handling, plus the subscription fee.
So, I have configured a recurrent service for the handling: Period=every 30 days, Rule= Apply Service every Y days, the rest in blank.

When must the crons be executed? and which?

Code:
0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_alarm.php
0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_alarm.php
0 14 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_batch_process.php
0 14 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_bill_diduse.php
0 14 15 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_check_account.php
0 14 15 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_invoice_cront.php
0 14 15 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_subscription_fee.php
0 14 15 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/currencies_update_yahoo.php


I guess the the a2billing_subscription_fee.php must run on 25 of each month. but, what is the function of these jobs?:
a2billing_alarm.php
a2billing_batch_process.php
a2billing_bill_diduse.php
a2billing_check_account.php
a2billing_invoice_cront.php

Thanks for your help!
Christancho


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2008 12:24 am 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
christancho wrote:
When must the crons be executed? and which?
Most of them need to run monthly I believe, but you can check the suggested schedule in the comments at the top of the source code for each cron job.
This is the schedule I use:
Code:
# Run the Alarms report each hour at :00
0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_alarm.php
# Bill DID usage at 00:00 each day
0 0 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_bill_diduse.php
# Batch process at 00:20 each day
20 0 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_batch_process.php
# Generate invoices each day at 07:00
0 7 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_invoice_cront.php
# Remind users of low balance every 7 days at 06:00
0 6 */7 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_check_account.php
# Charge subscriptions at 06:05 on the 1st of each month
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_subscription_fee.php
# Run Autorefill at 00:15 on the 1st of each month
15 0 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_autorefill.php
# Update currencies at 06:00 each day
0 6 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/currencies_update_yahoo.php

Quote:
what is the function of these jobs?
Hopefully the comments in my crontab will give you a clue.

Added after 6 minutes:

stavros wrote:
christancho wrote:
When must the crons be executed? and which?
You can check the suggested schedule in the comments at the top of the source code for each cron job.
This is the schedule I use, which is a little different from the suggested times:
Code:
# Run the Alarms report each hour at :00
0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_alarm.php
# Bill DID usage at 00:00 each day
0 0 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_bill_diduse.php
# Batch process at 00:20 each day
20 0 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_batch_process.php
# Generate invoices each day at 07:00
0 7 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_invoice_cront.php
# Remind users of low balance every 7 days at 06:00
0 6 */7 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_check_account.php
# Charge subscriptions at 06:05 on the 1st of each month
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_subscription_fee.php
# Run Autorefill at 00:15 on the 1st of each month
15 0 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_autorefill.php
# Update currencies at 06:00 each day
0 6 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/currencies_update_yahoo.php

Quote:
what is the function of these jobs?
Hopefully the comments in my crontab will give you a clue.


Top
 Profile  
 
 Post subject: Invoices not being charged properly
PostPosted: Sun Dec 21, 2008 5:45 am 
Offline

Joined: Fri Aug 17, 2007 6:14 pm
Posts: 6
hello, i am testing out the PHP scripts which are intended to be run as a cron job... the subscription fee is billed whenever i run the script which is good. but my invoices arent being generated by the php script 'a2billing_invoice_cront.php" . i run the script manually and it pauses to think for a second, then returns to the shell. i look in the invoices section and i see nothing. if i generate an invoice manually it works ok. so basically, the script seems to be doing nothing.

any ideas why the script isnt working? i have no clue how this script works and just feel lucky the subscription script works ok. : )

also, after readinging the user manual and stavros' posts earlier in this thread i had some questions:

1) is the generate invoices script supposed to be run each day? i see stavros's crontab has subscriptions being run on the 1st of the month, but the invoice script is being run every day. why is that? i am obviously not an expert but i thought that it would make sense to run the subscription script monthly and the invoice generate script monthly, right after the subscription script completes. No? And if no, why not? Im asking to educate, not out of sarcasm : )

2) if i add a payment thru billing -> add payment it will not update the customers balance. i must do this manually. is this correct? is there any way to automate when a payment is added, that the account balance will be auto updated? (manually, or thru paypal, authorize.net , etc)

3) if i add a charge via billing-> add charge , should this add or subtract from the customers account balance? if i try to add either a positive or negative charge, it doesnt update the account balance. however, if i generate an invoice manually, i see the + or - charge on the invoice and it adds or subtracts from the total of the invoice. but again, the customers balance doesnt reflect the invoice charge. is this normal?

sorry for the long winded post : ) ive been at this for a while and need some help here. i feel like i might be misunderstanding something key about how the billing system works. i did read the manual but still need some help! thanks!


Top
 Profile  
 
 Post subject: Re: Invoices not being charged properly
PostPosted: Mon Dec 22, 2008 1:15 am 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
ryandasilva wrote:
any ideas why the script isnt working?
Turn up the debug level and dissect the output. I can't remember right now how it works exactly.
Quote:
1) is the generate invoices script supposed to be run each day? i see stavros's crontab has subscriptions being run on the 1st of the month, but the invoice script is being run every day. why is that?
The way I do may well be incorrect; I've never had the invoicing working to my satisfaction.
Quote:
2) if i add a payment thru billing -> add payment it will not update the customers balance. i must do this manually. is this correct?
This is by design I believe. Each Payment added should be associated with a Refill. View Money Situation shows you who owes what if you stick to this discipline.
Quote:
is there any way to automate when a payment is added, that the account balance will be auto updated? (manually, or thru paypal, authorize.net , etc)
The payment gateways do automatically update the balance.

Sorry, I don't know the answer to your 3rd question.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Voice Broadcast System


All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group