Page 9 of 20 FirstFirst ... 789101119 ... LastLast
Results 81 to 90 of 191

Thread: How-to for crontab

  1. #81
    Join Date
    Dec 2005
    Beans
    134

    Re: How-to for crontab

    Try escaping the percent signs with backslashes:

    Code:
     ... /path/to/backup/dbbackup_`date +\%b\%d`.sql
    They are special characters and I think maybe sh is breaking on them.

  2. #82
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Beans
    15

    Re: How-to for crontab

    I have been using gawk to help name compressed versions of my testing server Harry's MySQL dump file called imaginatively enough "SqlDump.sql" The shell script looks like this:

    # Small script to compress the dump file and add DOW
    tar -cvpzf Harry`date |gawk '{print$1}'`Bk.tar.tgz SqlDump.sql
    echo now its all squished up

    The output is HarrySunBk.tar.tgz

    This gives a rolling 7 days available on my test server for rolling back. I also use gawk (on my backup server)to rename files I pull daily to the backup server. On my testing server I run the same script but without the gawk part to generate the target for this pull.

    You may insert $1$2$3$4$5 or parts therof to get the desired date parts you want.

    You will need to install gawk using #apt-get install gawk
    I hope this is of some use

  3. #83
    Join Date
    Aug 2008
    Beans
    13
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How-to for crontab

    Quote Originally Posted by chenel View Post
    Try escaping the percent signs with backslashes:

    Code:
     ... /path/to/backup/dbbackup_`date +\%b\%d`.sql
    They are special characters and I think maybe sh is breaking on them.
    Thank You! You must be right about them being special characters (perhaps signifying EOF). Your suggestion worked!
    Last edited by Dragon Smaug; August 21st, 2008 at 06:07 PM. Reason: adding in quote to show who responding to

  4. #84
    Join Date
    Sep 2007
    Beans
    11

    Re: How-to for crontab

    I am trying to set up cron to run a script. I thought I had done everything right but the script didnt autorun...soooo...I tried this as a benchmark..just for cron to launch pidgin every minute...well..it doesnt launch pidgin either...what am I doing wrong?

    gempak@xxxxxxx:/data/ldm/gempak/tasksched$ crontab -l
    * * * * * pidgin

  5. #85
    Join Date
    Dec 2005
    Beans
    134

    Re: How-to for crontab

    Quote Originally Posted by Omega2Four View Post
    I am trying to set up cron to run a script. I thought I had done everything right but the script didnt autorun...soooo...I tried this as a benchmark..just for cron to launch pidgin every minute...well..it doesnt launch pidgin either...what am I doing wrong?

    gempak@xxxxxxx:/data/ldm/gempak/tasksched$ crontab -l
    * * * * * pidgin
    Probably it's the same issue as one that people were having earlier in the thread: you need to put the FULL path of any program you want to run. On my machine, anyway, pidgin lives in /usr/bin/ (you can find out where it lives by doing 'which pidgin' at a terminal), so the line you want would be
    Code:
    * * * * * /usr/bin/pidgin
    Hope this helps.

  6. #86

    Re: How-to for crontab

    Disregard below. I hadn't scrolled to page 9 of the thread yet. Nevermind.

    Hi,

    I just ran into this and found this thread googling for the answer.
    Looks like this will be your solution, but I haven't tried it myself yet:

    http://www.mail-archive.com/freebsd-.../msg22297.html

    Summing it up:
    Crontab treats '%' characters specially --- see crontab(5). It will
    automatically replace a '%' character with a newline, as a method of
    being able to include multiline shell input into the crontab file.

    To get a literal '%', type '\%'

    Good luck!

    René
    Last edited by Iturbide; October 9th, 2008 at 10:25 AM. Reason: Correction

  7. #87
    Join Date
    Dec 2007
    Beans
    3

    Re: How-to for crontab

    For those new to Ubuntu, like me... if you find that "crontab -e" give you a missing command error, then you need to install the package cron

    sudo apt-get install cron

  8. #88
    Join Date
    Oct 2008
    Beans
    2

    Re: How-to for crontab

    In the hopes that this will save someone the time I just wasted, also be very sure that your crontab line is ended with a carriage return. If you don't your command will not run, you may not get any error message, and frowning may ensue.

    correct:
    * * * * * /usr/bin/touch /tmp/this.file
    <EOF>

    incorrect:
    * * * * * /usr/bin/touch /tmp/this.file<EOF>

  9. #89
    Join Date
    Jul 2007
    Beans
    Hidden!

    Re: How-to for crontab

    "frowning may ensue"

    I know the feeling.

    About your post:

    Carriage Return (13) is Mac. Line Feed (10) is Unix/Linux.
    I always just say Line Break or New Line when referring to creating a line - that avoids confusion.

  10. #90
    Join Date
    Mar 2007
    Location
    Denver, CO
    Beans
    7,558
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How-to for crontab

    Just wondering if you could add instructions on how to modify the system wide crontab file. This capability may want to be added -- for example to periodically update the dyndns address, or something similar.

    That would be great, since the process is slightly different than the user crontab procedure.

Page 9 of 20 FirstFirst ... 789101119 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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