1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

/etc/cron.daily/60sa-update unexpected operator

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by Knarf, Feb 13, 2011.

  1. Knarf

    Knarf Basic Pleskian

    18
    85%
    Joined:
    Jan 22, 2011
    Messages:
    60
    Likes Received:
    0
    Location:
    The Netherlands
    PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE
    Parallels Plesk Panel v10.1.1, Ubuntu 10.04 x86_64

    PROBLEM DESCRIPTION AND STEPS TO REPRODUCE
    This command line:
    /etc/cron.daily/60sa-update

    generates this error:
    [: 9: 1: unexpected operator
    [: 14: 1: unexpected operator

    Also in the daily e-mail I receive this message:
    /etc/cron.daily/60sa-update:
    [: 9: 1: unexpected operator
    [: 14: 1: unexpected operator
    run-parts: /etc/cron.daily/60sa-update exited with return code 1

    ACTUAL RESULT
    /etc/cron.daily/60sa-update returning:
    [: 9: 1: unexpected operator
    [: 14: 1: unexpected operator

    EXPECTED RESULT
    /etc/cron.daily/60sa-update returning no errors

    ANY ADDITIONAL INFORMATION
    Line 9 and 14 refer to the closing "fi" of the "if" statement, but I could not find anything wrong with "fi".
    After searching for possible solutions, I changed #!/bin/sh on line 1 to #!/bin/bash and this seems to work: no errors anymore!
    I just don't know why #!/bin/sh isn't working as other scripts have #!/bin/sh as well but they don't produce errors.
     
    Last edited: Feb 13, 2011
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,564
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    It is already known problem and should be fixed soon.
     
  3. Knarf

    Knarf Basic Pleskian

    18
    85%
    Joined:
    Jan 22, 2011
    Messages:
    60
    Likes Received:
    0
    Location:
    The Netherlands
    Okay, thanks.
     
  4. GeraldV

    GeraldV New Pleskian

    19
    85%
    Joined:
    Mar 19, 2010
    Messages:
    14
    Likes Received:
    0
    The error is in the "fi" line because the "if" statement is a single statement which ends on the "fi" line.

    The problem is the test condition. "==" is not defined with the "test" or "[" command which is used when shell is /bin/sh.

    bash implements its own test/[ command internally which accepts "==" as string comparsion. That's why using bash does not result in a syntax error.

    However, this is not really the correct fix. The test should be an arithemetic comparison and not a string comparison. The test is supposed to compare the error code of the command with a number. This the correct way to fix this would be to replace "==" with "-eq" which is the numeric comparison in test/[ and bash.
     
  5. CerdanS

    CerdanS Basic Pleskian

    15
     
    Joined:
    May 3, 2011
    Messages:
    36
    Likes Received:
    0
    2009 problem started... 05/2011 still active...

    Hi,

    I have 2 servers, one on Plesk 8.3, and another on Plesk 10, Plesk 10 sends me every single day I receive :

    /etc/cron.daily/60sa-update:
    [: 9: 1: unexpected operator
    [: 14: 1: unexpected operator
    run-parts: /etc/cron.daily/60sa-update exited with return code 1

    From : Cron <root@xxxxxxxxx> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

    PLESK 10 on DEBIAN (Linux 2.6.32-22-server)

    The problem is not solved yet it seems since january...
     
    Last edited: May 3, 2011
  6. Elisy

    Elisy Guest

    0
     
    Hey,

    I changed the file /etc/cron.daily/60sa-update so the error is gone, and i added a little comment for extra information.

    This is what i have now:



    #!/bin/sh

    /usr/bin/sa-update
    ERR=$?

    case $ERR in
    0)
    echo "Installing updates for SpamAssassin"
    /etc/init.d/psa-spamassassin restart | tee -a /var/log/sa-update.log;
    echo "Updates successfully installed"
    ;;
    1)
    echo "No updates found for SpamAssassin"
    exit 0;
    ;;
    esac

    exit $ERR
     
  7. elemental.tm

    elemental.tm Basic Pleskian

    20
     
    Joined:
    Feb 24, 2011
    Messages:
    50
    Likes Received:
    0
    Location:
    United Kingdom
    I take it this is the best solution until as such time as Parallels offer a permanent fix. My thanks to you Elisy!
     
  8. GeraldV

    GeraldV New Pleskian

    19
    85%
    Joined:
    Mar 19, 2010
    Messages:
    14
    Likes Received:
    0
    There is no need to edit that much. All you have to do is to replace the "==" with "-eq". That will make it a numeric comparison.
     
  9. elemental.tm

    elemental.tm Basic Pleskian

    20
     
    Joined:
    Feb 24, 2011
    Messages:
    50
    Likes Received:
    0
    Location:
    United Kingdom
    Was this bug ever fixed? I'm running 10.3.1 and I have just had to apply this workaround...
     
  10. fruf

    fruf New Pleskian

    17
    85%
    Joined:
    Jan 22, 2011
    Messages:
    23
    Likes Received:
    0
    After upgrading to 10.4.4 the problem is still there
     
  11. Stefan Becker

    Stefan Becker Basic Pleskian

    22
     
    Joined:
    May 19, 2009
    Messages:
    69
    Likes Received:
    0
    I can confirm this.

    Plesk 10.4.4 MU5
     
  12. xxxxxx

    xxxxxx Guest

    0
     
    Thank You!
    This seems to fix the problem for me.
     
  13. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,564
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
  14. robin24

    robin24 Guest

    0
     
    At the time of me writing this, it is February 4, 2012. This thread was started about a year ago, several Plesk updates were issued in this time frame. Yes, fixing this error was extremely simple. But, apparently, it was too challenging for Parallels to just fix this by simply issuing an update. Seriously, this is a shame. Now, of course, this was a small problem that caused some errors but was easy to deal with. But what if, for example, there are any serious security wholes that show up in Plesk? Do they take over a year to be fixed as well? I'm honestly not sure if I should use Plesk in a production environment, where stability and security are more than essential...
     
  15. ChimezieE

    ChimezieE Guest

    0
     
  16. ChimezieE

    ChimezieE Guest

    0
     
Loading...