FreeBSD issues with date & du

Help
George
2011-11-03
2013-05-29
  • George
    George
    2011-11-03

    Hi, I am trying to use this on a FreeBSD box but it seems that there might be some problems with the date & du format. I get:
    The backups are done successfully but I get those errors:

    ###### WARNING ######
    Errors reported during AutoMySQLBackup execution.. Backup failed
    Error log below..
    usage: date     [-vval] …
                [-f fmt date | [[[[yy]mm]dd]HH]MM]
    usage: date     [-vval] …
                [-f fmt date | [[[[yy]mm]dd]HH]MM]
    usage: date     [-vval] …
                [-f fmt date | [[[[yy]mm]dd]HH]MM]
    usage: date     [-vval] …
                [-f fmt date | [[[[yy]mm]dd]HH]MM]
    /usr/local/bin/automysqlbackup: line 1100: ((: 0 != 0 && ( 3 == 0 ||  3 ==  &&  < 0) : syntax error: operand expected (error token is "&&  < 0) ")
    /usr/local/bin/automysqlbackup: line 1166: ((: 0 != 0 && ( 3 == 0 ||  3 ==  &&  < 0) : syntax error: operand expected (error token is "&&  < 0) ")
    du: illegal option - D
    usage: du         

    Any workarounds maybe ?

    Thanks

     
  • trustadvert
    trustadvert
    2011-11-07

    same problem here.

    have to switch back to the old 2.5 version on my bsd boxes :(

     
  • George
    George
    2011-11-09

    I have fixed the du issue by changing

    echo `du -hsD "${CONFIG_backup_dir}"` to:

    echo `du -hsc "${CONFIG_backup_dir}"`

    Rotation also seems to work. I am trying to figure out the date errors

     
  • PittaGurneyi
    PittaGurneyi
    2011-11-13

    Hi, sorry I was away for two weeks …
    Everything should have been fixed already, but since I was away and didn't have time before to test it, version rc1 wasn't released until 5 minutes ago (it has the fixes and new stuff). If you encounter errors in the new version, report it and I will take a look at it as soon as possible.

     
  • George
    George
    2011-11-23

    Hi, now I am getting the follwoing errors:

    # /usr/local/bin/automysqlbackup /usr/local/etc/automysqlbackup/server.conf

    Backup End Time Wed Nov 23 02:43:57 EET 2011

    Total disk space used for backup storage…
    Size - Location
    16M /var/automysql/db

    ======================================================================

    ###### WARNING ######
    Errors reported during AutoMySQLBackup execution.. Backup failed
    Error log below..
    ./automysqlbackup: line 191: printf: bc:: invalid number
    ./automysqlbackup: line 191: printf: stdin:2:: invalid number
    ./automysqlbackup: line 191: printf: syntax: invalid number
    ./automysqlbackup: line 191: printf: error:: invalid number
    ./automysqlbackup: line 191: printf: auto: invalid number
    ./automysqlbackup: line 191: printf: unexpected: invalid number
    ./automysqlbackup: line 191: printf: bc:: invalid number
    ./automysqlbackup: line 191: printf: stdin:2:: invalid number
    ./automysqlbackup: line 191: printf: syntax: invalid number
    ./automysqlbackup: line 191: printf: error:: invalid number
    ./automysqlbackup: line 191: printf: auto: invalid number
    ./automysqlbackup: line 191: printf: unexpected: invalid number
    find: /var/automysql/db/status: No such file or directory

     
  • PittaGurneyi
    PittaGurneyi
    2011-11-23

    Now it's time, that you give me more information about your system, because I can't recreate the error.
    uname -a
    bc -v
    bash -version
    Create a script with the content:

    #!/usr/bin/env bash
    set -x
    export LC_ALL=C
    bc_ceil="define ceil(x) { auto savescale; savescale = scale; scale = 0; if (x>0)
    { if (x%1>0) result = x+(1-(x%1)) else result = x } else result = -1*floor(-1*x
    );  scale = savescale; return result }"
    bc_floor="define floor(x) { auto savescale; savescale=scale; scale=0; if (x>0) r
    esult=x-(x%1) else result=-1*ceil(-1*x); scale=savescale; return result }"
    bc_mod="define mod(x,y) { auto savescale; savescale=scale; scale=0; result=x%y;
    scale=savescale; return result }"
    bc_dom="define dom(x,y) { auto savescale; savescale=scale; scale=8; a=30+mod(x+f
    loor(x/8),2); if (x==2) a-=2; if (x==2 && mod(y,4)==0 && (y<100 || mod(y,100)!=0
    || mod(y,400)==0)) a+=1; scale=savescale; return a }"

    # @params:      #month  #year
    # @deps:        (none)
    days_of_month() {
    printf '%.0f\n' $(echo -e "scale=0\n"$bc_ceil$bc_floor$bc_mod$bc_dom"dom($1,$2)"
    | bc -l)
    }
    days_of_month 8 2011

    Make it executable, i.e. chmod +x script
    Run it and post the output.

     
  • George
    George
    2011-11-23

    1) FreeBSD 9.0-RC2 #1: Wed Nov  9 22:30:09 EET 2011

    2) bc (BSD bc) 1.0-FreeBSD

    3) GNU bash, version 4.1.11(0)-release (amd64-portbld-freebsd9.0)

    script results:

    + export LC_ALL=C
    + LC_ALL=C
    + bc_ceil='define ceil(x) { auto savescale; savescale = scale; scale = 0; if (x>0)
    { if (x%1>0) result = x+(1-(x%1)) else result = x } else result = -1*floor(-1*x
    );  scale = savescale; return result }'
    + bc_floor='define floor(x) { auto savescale; savescale=scale; scale=0; if (x>0) r
    esult=x-(x%1) else result=-1*ceil(-1*x); scale=savescale; return result }'
    + bc_mod='define mod(x,y) { auto savescale; savescale=scale; scale=0; result=x%y;
    scale=savescale; return result }'
    + bc_dom='define dom(x,y) { auto savescale; savescale=scale; scale=8; a=30+mod(x+f
    loor(x/8),2); if (x==2) a-=2; if (x==2 && mod(y,4)==0 && (y<100 || mod(y,100)!=0
    || mod(y,400)==0)) a+=1; scale=savescale; return a }'
    + days_of_month 8 2011
    ./test: command substitution: line 20: syntax error near unexpected token `|'
    ./test: command substitution: line 20: `| bc -l)'

    Thanks

    George

     
  • PittaGurneyi
    PittaGurneyi
    2011-11-24

    Resolved in 3.0_rc3. Please try it and tell me if it works.

     
  • George
    George
    2011-11-24

    Yes it does thanks!