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
    433
    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,222
    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?

Similar Threads

  1. Cron Times, hwo to setup a cron to run every 15 mintues?
    By build-a-host in forum Running a Web Hosting Business
    Replies: 5
    Last Post: 02-22-2008, 04:54 AM
  2. Cron job Help: Can any one Help with Commands for Cron Jobs????
    By pal_web in forum Hosting Security and Technology
    Replies: 4
    Last Post: 06-16-2006, 02:43 PM
  3. run-parts /etc/cron.daily & Anacron job 'cron.daily problems
    By 0218 in forum Hosting Security and Technology
    Replies: 0
    Last Post: 12-12-2004, 10:24 PM
  4. Replies: 1
    Last Post: 01-11-2003, 06:57 PM
  5. HELP! Cron <root@ws1> run-parts /etc/cron.daily
    By Domenico in forum Dedicated Server
    Replies: 2
    Last Post: 04-03-2001, 06:15 PM

Posting Permissions

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