Results 1 to 7 of 7

Thread: How do I schedule Unison with cron?

  1. #1
    Join Date
    Jan 2008
    Location
    North Alabama
    Beans
    125
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    How do I schedule Unison with cron?

    Alright, I've never used cron before and frankly I have no idea how to. I've read a few things but it makes no sense at all to me.

    I have Unison setup to sync my files to a USB drive and it works fine if I run it by hand. I want to schedule it to run every night at 7pm but as I said earlier, I have no idea how to.

    If someone could tell me exactly what to do, that would be awesome!

    Thanks!
    “We cannot defend freedom abroad by deserting it at home.”
    -Thomas Jefferson

  2. #2
    Join Date
    Dec 2006
    Location
    Hamburg, Germany
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How do I schedule Unison with cron?

    Create a textfile in your /home folder and name it "cronjobs.txt".

    Open it and add the line
    Code:
    0 19 * * * /usr/bin/unison [options]
    Then run
    Code:
    crontab -u USERNAME cronjobs.txt
    where USERNAME is your username. Verify with
    Code:
    crontab -l
    The syntax of a cronjob is

    minutes(0-59) hours(0-23) day(0-27/28/29/30) month(0-11) weekday(0-6) command

    where a * stands for "any value"
    Last edited by northern lights; July 24th, 2008 at 09:59 PM.
    One ought, every day at least, to hear a little song, read a good poem, see a fine picture, and, if it were possible, speak a few reasonable words...

  3. #3
    Join Date
    Jan 2008
    Location
    North Alabama
    Beans
    125
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How do I schedule Unison with cron?

    Thank you very much. That simple post was a thousand times easier than all these pages and pages of tutorials. Concise is the way to go, I thank you kind sir.
    “We cannot defend freedom abroad by deserting it at home.”
    -Thomas Jefferson

  4. #4
    Join Date
    Dec 2006
    Location
    Hamburg, Germany
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How do I schedule Unison with cron?

    Not to worry. Notice the slight changes (edited the above while you posted the reply).

    --> just installed unison to verify few things...
    One ought, every day at least, to hear a little song, read a good poem, see a fine picture, and, if it were possible, speak a few reasonable words...

  5. #5
    Join Date
    Jul 2007
    Beans
    277

    Re: How do I schedule Unison with cron?

    A slight expansion on:

    0 19 * * * /usr/bin/unison [options]
    When you did your manual run of unison you will have created a profile. To run in background from cron, use:

    Code:
    unison -batch "profilename"
    The quotes are needed.

    Also, if you find you're still struggling with cron, there is a gui tool to make it easier to set up called gnome-schedule.

  6. #6
    Join Date
    Nov 2006
    Beans
    Hidden!

    Re: How do I schedule Unison with cron?

    Thanks so much for this. Gnome-schedule and Unison plus your command took me less than 1 minute to setup! Awesome.

  7. #7
    Join Date
    Jun 2009
    Beans
    27

    Re: How do I schedule Unison with cron?


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
  •