Results 1 to 6 of 6
  1. #1

    Cron does not work

    Hey,

    I've got a script that is suppose to dump a sqlite database daily works fine via SSH but when put in a cron it gives this error:

    Online database dump in progres please wait...
    /backup/scripts/murmur_sqlite: line 10: /backup/mumble/$DAY-$TIME.sql: ambiguous redirect
    DONE!

    Heres the script:

    Code:
    #!/bin/bash
    # Mumble SQLLite Database Live Dump
    
    echo "Online database dump in progres please wait..."
    TIME=$(date +%k%M)
    DAY=`/bin/date +%d%m%Y`
    
    #echo "$DAY-$TIME"
    
    sqlite3 /mumble/murmur.sqlite .dump > /backup/mumble/$DAY-$TIME.sql
    echo " DONE!"
    What is the issue?

    Thanks,

    Tom

  2. #2
    Once make sure the crond service is running on the server if not restart the crond service by using,
    #service crond restart
    Shared Hosting | Reseller Hosting | VPS Hosting | Dedicated Servers
    KeserHosting.Com

  3. #3
    Join Date
    Aug 2009
    Posts
    79
    Its ambiguous redirect because you are not redirecting to single file.

  4. #4
    How do you mean? The script just redirects the output from the sqlite command to a single file based on the time/date. I'm not attempted to direct to multiple files (Or as far as i'm aware).

    Also the cron does run thats not the issue - the error I quotes comes from the mailbox of the user who ran the cron.

    Quote Originally Posted by TheOnly92 View Post
    Its ambiguous redirect because you are not redirecting to single file.

  5. #5
    Join Date
    Mar 2009
    Location
    /home/khunj
    Posts
    432
    The %k parameter will output one space char before the digit if the hour value is lower than 10 : ' 0', ' 1', ' 2' etc...
    Using %H should solve the problem as it will always display 2 digits: '00', '11' etc

    You can also only run the date command once :
    Code:
    DAY=`/bin/date +%d%m%Y-%H%M`
    sqlite3 /mumble/murmur.sqlite .dump > /backup/mumble/$DAY.sql
    NinTechNet
    ★ NinjaFirewall : Web Application Firewall for PHP and WordPress.
    ★ NinjaMonitoring : Monitor your website for suspicious activities.

  6. #6
    Join Date
    Mar 2009
    Posts
    2,218
    Quote Originally Posted by Tomdarkness View Post
    Hey,

    I've got a script that is suppose to dump a sqlite database daily works fine via SSH but when put in a cron it gives this error:

    Online database dump in progres please wait...
    /backup/scripts/murmur_sqlite: line 10: /backup/mumble/$DAY-$TIME.sql: ambiguous redirect
    DONE!

    Heres the script:

    Code:
    #!/bin/bash
    # Mumble SQLLite Database Live Dump
    
    echo "Online database dump in progres please wait..."
    TIME=$(date +%k%M)
    DAY=`/bin/date +%d%m%Y`
    
    #echo "$DAY-$TIME"
    
    sqlite3 /mumble/murmur.sqlite .dump > /backup/mumble/$DAY-$TIME.sql
    echo " DONE!"
    What is the issue?

    Thanks,

    Tom
    Don't tell me, you're a programmer, so never arrive for work much before 10am ... :-)

    Are you by any chance running the cron job between midnight and 10am? So "TIME" has a leading blank when Cron runs?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •