The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cron Job Error: syntax error near unexpected token `('

Discussion in 'General Discussion' started by juliep, Sep 29, 2014.

  1. juliep

    juliep Registered

    Joined:
    Sep 29, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi I have created a cron job via my websites cPanel to backup our mySQL database each week using mysqldump, but I keep getting the following error via my email notification and I can not figure out what the problem is with the command line syntax. The only thing I can think of is there is a '(' character within my password string - could this be causing the problem?

    The error received is:
    /usr/local/cpanel/bin/jailshell: -c: line 0: syntax error near unexpected token `('
    /usr/local/cpanel/bin/jailshell: -c: line 0: `/usr/bin/mysqldump -u myusername -pPassword123](8 mydatabasename > /home/sitefolder/backups/weeklybackup.sql'

    Any help is much appreciated :)

    Julie
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    I suggest setting up a script that completes the database backup, and then simply execute that script in the cron job. It's not a good idea to pass a password in plaintext via a cron job. This is an older thread, but it will give you an idea of how you can accomplish this:

    Backup databases through cron job

    Thank you.
     
Loading...

Share This Page