Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I've been trying to setup a cron job without any success. I've read quite alot of articles about cron jobs and i've tried so many different variants but nothing ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    13

    Setting up a cron job?


    Hello,

    I've been trying to setup a cron job without any success. I've read quite alot of articles about cron jobs and i've tried so many different variants but nothing seems to work.

    Here's the current cron job i've setup:

    30 * * * * /usr/bin/php -q /home/a/c/acornmedia/public_html/cron.php > /dev/null

    i know the first part is the time i want it to run, (every 30 minutes)
    the second part specifies the location of php? (this is where my host told me.)
    -q ?? i've no real idea what this does.
    this is the path to my live website files.
    > ?? not really sure
    /dev/null ignores display warnings?

    Can anyone spot what i've done wrong?

    the cron.php file only has this wrote in:

    <?php
    mail('example@example.com', 'test message', 'test message');
    ?>

    (i've removed the real address.)

    Thanks

  2. #2
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    if you just run this command
    Code:
    /usr/bin/php -q /home/a/c/acornmedia/public_html/cron.php > /dev/null
    does it do what you want?

  3. #3
    Just Joined!
    Join Date
    Jun 2008
    Posts
    13
    No, it doesn't seem to do anything.

    What permissions do i need to give the cron.php? it currently has 755

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    sorry, what if you run it without the > /dev/null at the end?

    how about something like this as a command:
    Code:
    echo -e "Subject:Status Update\nFrom:SenderAddress <user@domain.com>\n"`cat attachment.txt` | sendmail user@domain.com
    or does it have to be the cron.php file?

  6. #5
    Just Joined!
    Join Date
    Jun 2008
    Posts
    13
    Well the cron.php file im trying to run is actually just a test file.

    I've got a few more complicated php files that i need to run to do hourly/daily tasks on our website.

    So i'm just using a very simple php file so i know that the file works, and there shouldn't be any problems with the actual php file.

    I've browsed to /usr/bin/ and php is there.

    And /home/a/c/acornmedia/public_html/ is the correct path to the web directory, as i've got a php script that uses this path to create backups to the web directory. (and i can browse to the file i want via cd /home/a/c/... etc/cron.php)

Posting Permissions

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