Results 1 to 5 of 5

Thread: Cron Job

  1. #1
    Join Date
    Jan 2006
    Beans
    201

    Cron Job

    I'm trying to schedule a basic HTTP download thro a cron job. Except I totally lack skills using linux. I got told to download Wget, so I have that but, I still dont know how I would set up the cron job.

    What would be the command to download www.example.com/example.exe thro HTTP at 3:00am the day after the command was set???

    Thanks so so much.

    Daniel

  2. #2
    Join Date
    Jan 2008
    Location
    /dev/null
    Beans
    2,793
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Cron Job

    Quote Originally Posted by Drezard View Post
    I'm trying to schedule a basic HTTP download thro a cron job. Except I totally lack skills using linux. I got told to download Wget, so I have that but, I still dont know how I would set up the cron job.

    What would be the command to download www.example.com/example.exe thro HTTP at 3:00am the day after the command was set???

    Thanks so so much.

    Daniel
    Code:
    * 3 * * *  DISPLAY=:0. /path/to/command
    Will run a graphical application at 3am daily on display 0 (normally thats your desktop)

  3. #3
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Cron Job

    why do you give an example to a gui app if he just wants to wget something?

  4. #4
    Join Date
    Jan 2008
    Location
    /dev/null
    Beans
    2,793
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Cron Job

    Quote Originally Posted by hyper_ch View Post
    why do you give an example to a gui app if he just wants to wget something?
    whoops. I misread and thought he said gwget.
    Code:
    * * 3 * * /path/to/command
    should sort him. (though he may need to redirect errors to /dev/null or run wget in screen- Idk because its not something i've bothered to do in the past)

  5. #5
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Cron Job

    ah, misread can happen (happens also to me)... I was just curious why you gave that other one

    so in the example given I would

    (1) create a a bash script like wget.sh:
    Code:
    #!/bin/bash
    cd /path/where/you/want/to/save/that/file/to/
    wget http://http://www.example.com/example.exe
    (2) make it executable
    Code:
    chmod 0755 wget.sh
    (3) make a cron.txt file that contains all the cron jobs (I prefer working on text files like that
    Code:
    nano cron.txt
    (4) add the cron jobs to it:
    Code:
    * * 3 * * sh /path/to/wget.sh
    (5) add cron.txt to the actual cronjob
    Code:
    crontab cron.txt
    (6) check the content of the cronjob
    Code:
    crontab -l

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
  •