Forums

stassen
stassen
Offline
Resolved
0 votes
My family is using several voip services from the betamax family. To make sure that everything is not running too low on credit I would like to use the following script ( http://www.timedicer.co.uk/programs/help/dellmont-credit-checker.sh.php#Description ) in crontab so this check can be scheduled...

I tried to get this running on my Clearos 6.5 machine by putting the script in the /var/www/<voip_dir> location with the appropriate rights, but I need some help to get things going...
Can someone confirm that CGI is standard available including the following dependencies (awk, bash, coreutils, curl, grep, openssl, sed, [sendmail], umask). New to this how to check this,..
Sunday, February 19 2017, 07:20 PM
Share this post:
Responses (7)
  • Accepted Answer

    stassen
    stassen
    Offline
    Tuesday, February 21 2017, 07:39 PM - #Permalink
    Resolved
    0 votes
    So it works.... (and it is perfect)

    If 2 helpfull people stating that they only have 544 lines, I did something wrong (downloaded it initially via windows and uploaded it via WinSCP to my machine)... What I don't know exactly, but I decided it to download it via Wget directly. Almost instant succes, because after creating the .conf file, it verifies my accounts in a few seconds. Great !

    Working on some details now. Again thanks for supporting in this. Super !
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, February 21 2017, 12:27 AM - #Permalink
    Resolved
    0 votes
    Like Nick I only downloaded 544 lines. However, the last line is missing a line feed. On linux files they should end with just line feed - no carriage returns whatsoever.
    Adding a line feed now makes mine 545 lines. Without an account the script cannot be tested properly... i.e. using a dummy conf file.. - but no script errors...

    [root@alex ~]# ./dellmont-credit-checker.sh

    dellmont-credit-checker.sh v4.4.1 [29 Jun 2016] by Dominic
    ==========================
    www.voipdiscount.com myaccount for credit >300 cents: Error: www.voipdiscount.com / myaccount - CREDITCENTS is blank
    Error 11 occurred for www.voipdiscount.com myaccount
    [root@alex ~]#

    @stasses How did you download the script - I used a linux workstation and Firefox which provided a direct download. Chrome wanted to display the script on the screen. To 'Copy and Paste' on such a long file would be a difficult way to get exactly right, especially as one line is 296 characters, and there are others almost as long :-( Suspect that perhaps your file is longer as some of the long lines have 'wrapped'?
    The reply is currently minimized Show
  • Accepted Answer

    Monday, February 20 2017, 08:00 PM - #Permalink
    Resolved
    0 votes
    The script I downloaded is 544 lines. All the end stuff is error checking of the configuration file. How have you set your configuration file and did you make sure it had a CR/new_line after the last entry?
    The reply is currently minimized Show
  • Accepted Answer

    stassen
    stassen
    Offline
    Monday, February 20 2017, 07:28 PM - #Permalink
    Resolved
    0 votes
    Indeed a bit Weird...

    sh-4.1# ./dellmont-credit-checker.sh
    ./dellmont-credit-checker.sh: line 563: unexpected EOF while looking for matching `''
    ./dellmont-credit-checker.sh: line 565: syntax error: unexpected end of file

    But the script is only 564 line. No scripting skills on this side and google on the errors does not supply the solution yet
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, February 19 2017, 08:33 PM - #Permalink
    Resolved
    0 votes
    I only get 544 lines in the script ......
    The reply is currently minimized Show
  • Accepted Answer

    stassen
    stassen
    Offline
    Sunday, February 19 2017, 08:03 PM - #Permalink
    Resolved
    0 votes
    Thank you for your help so far... I do have the dev-tools installed also, but nevertheless good to know how to check if something is available. Still to do the check...

    Tried to run this from the command line but without success. Issue on line 563/565 which is at the end of the script.. Then I tried to use my local web server but also no success. Therefore I m currently here.... ;)
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, February 19 2017, 07:50 PM - #Permalink
    Resolved
    0 votes
    You can check for installed functions with something like "which function_name" or "rpm -qa | grep function_name". The first tests for an executable, the second for an installed package. I suspect they are all in ClearOS but I have all teh development tools installed as well so I can't say how each package got there. Most are basic but I'm not sure about coreutils.

    It looks like it should be run as a cron job and not in the web server. Try just sticking it somewhere, giving it execute permissions and then running it manually in a console.

    [edit]
    Rather than use crontab, it is easier to put it somewhere like /etc/cron.daily and ClearOS will look after it on its daily schedule
    [/edit]
    The reply is currently minimized Show
Your Reply