Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    May 2010
    Location
    WA State
    Posts
    1,678
    Plugin Contributions
    3

    Default Setting up a cron job for the Snapshot add-on?

    First, I want to say that I LOVE this mod and would recommend that anybody concerned about security install it post-haste. It takes all the guess work out of detecting changed/added/deleted files. Now, on to my question.

    I've been trying to set it up to run as a cron job, but so far have been unsuccessful. I don't have any experience with setting up cron jobs, so I've been groping around in the dark. The cron runs, but doesn't generate anything.

    PHP Version is 5.2.17
    cPanel version is cPanel Pro 1.0 (RC1)

    Does anybody know what would be the correct entry for setting up the cron job?

  2. #2
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    785
    Plugin Contributions
    7

    Default Re: Setting up a cron job for the Snapshot add-on?

    Log in to your cPanel and look for the Cron Jobs icon:

    Click on the image and you’ll be asked to choose your experience level click on Standard.

    Creating a Cron Job
    Now that you’re at the Standard Cron Manager, let’s create a cron job. You can set a job to run at a specific interval or at a specific times. Creating a cron job requires only three simple steps:

    Enter your email address where it says: Please enter an email address where the cron output will be sent. Cron will send you a message when the job is executed, so you’ll know if there are any errors.
    In the Command to run: field, enter the full path to your script (You will find this information in /admin/backups/snapshot/snapshot_cron.php). To run a php file, the command will begin with php.
    Your path would look something like this:

    /home/site162/public_html/admin/backups/snap/snapshot_cron.php

    3. Now you need to set the schedule.
    Set the Minute(s). You can set a short interval here, or minutes of the hour (you can select multiple items in this—and the other— boxes by using the Shift and Command keys). If you don’t care about minutes, leave this set to 0).If you want to test things, set this to run Every Five Minutes. This is a good interval for running the script, checking your email for errors, and changing settings before your inbox gets inundated with cron messages.
    Set the Hour(s). If you’re creating a cron job to run RSS Import, you might want to set this to Every Hour. If you’re setting up a backup script, you might choose an hour in the middle of the night for nightly backups.
    Set the Day(s). You’ll probably want to leave this set to Every Day, but you can also choose specific days of the month.
    Set the Weekday(s).
    Set the Month(s).
    When you’ve set the schedule, your cron job is done. Click the Save Crontab button. If you set it to a short interval for testing, you should have an email with your output within a few minutes. If there’s an error (usually a problem with your path), check your settings.

    Also SnapShot can be set to send and email every time SnapShots runs. So in the cron command you should use:

    You can have cron send an email everytime it runs a command. If you do not want an email to be sent for an individual cron job you can redirect the command's output to /dev/null like this: mycommand >/dev/null 2>&1

    When you are done the command should look like this:
    This will run SnapShot ever 30min and only send a email when there was a change detected.

    0,30 * * * * php /home/site162/public_html/admin/snapshot_cron.php >/dev/null 2>&1

    Skip
    • 446F63746F722057686F •

  3. #3
    Join Date
    May 2010
    Location
    WA State
    Posts
    1,678
    Plugin Contributions
    3

    Default Re: Setting up a cron job for the Snapshot add-on?

    Okay, I'm an idiot. I had everything setup correctly, but I was pointing to my_admin/snapshot.php.

    Thanks for the help, and thanks for a valuable mod!

  4. #4
    Join Date
    May 2010
    Location
    WA State
    Posts
    1,678
    Plugin Contributions
    3

    Default Re: Setting up a cron job for the Snapshot add-on?

    Okay, did a couple tests running the cron. No content in the eMail sent. Does it only generate output when there are file changes?

  5. #5
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    785
    Plugin Contributions
    7

    Default Re: Setting up a cron job for the Snapshot add-on?

    Quote Originally Posted by RescoCCC View Post
    Okay, did a couple tests running the cron. No content in the eMail sent. Does it only generate output when there are file changes?
    I noticed missed stated the path of the command in last post it should be:
    /home/site162/public_html/admin/backups/snapshot/snapshot_cron.php
    With the cron setup as:

    0,30 * * * * php /home/site162/public_html/admin/backups/snapshot/snapshot_cron.php >/dev/null 2>&1
    It will run on the top of the hour and the half hour every hour of the day. (00:00 and 00:30) it will not send a notification email when it runs.

    You will only get a email if SnapShot finds a file added, file deleted, file changed, folder change, folder added, folder deleted etc.
    Then it is SnapShot that is sending the email not the cron.

    Removing >/dev/null 2>&1 from the end of the command the cron will send a email every time it runs. And if SnapShot sees a change it will also send a email.

    Skip
    Last edited by skipwater; 3 Jan 2012 at 01:21 AM.
    • 446F63746F722057686F •

  6. #6
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    785
    Plugin Contributions
    7

    Default Re: Setting up a cron job for the Snapshot add-on?

    You will find the path information that is needed for the cron in /admin/backups/snapshot/snapshot_cron.php file on line 7.
    This path was created for you when SnapShot was installed.

    Skip
    • 446F63746F722057686F •

  7. #7
    Join Date
    May 2010
    Location
    WA State
    Posts
    1,678
    Plugin Contributions
    3

    Default Re: Setting up a cron job for the Snapshot add-on?

    Yeah, I noticed the path error and used the correct path when setting it up. I've run some tests adding and deleting files. Running it from admin it picks them up fine, like it always has. But the cron eMail contains only:

    X-Powered-By: PHP/5.2.17
    Content-type: text/html

 

 

Similar Threads

  1. cron job for Recover Cart Sale add-on
    By pdxdoug in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 19 Sep 2015, 02:18 AM
  2. Replies: 7
    Last Post: 17 Jan 2014, 03:45 PM
  3. Admin auto login for a cron job
    By Gigo in forum Customization from the Admin
    Replies: 20
    Last Post: 9 Aug 2012, 07:39 AM
  4. Cron Job for Optimize Database
    By Convergence in forum General Questions
    Replies: 4
    Last Post: 24 Jan 2011, 09:36 PM
  5. Cron Job for Updating QTY
    By ryanb4614 in forum General Questions
    Replies: 2
    Last Post: 9 Aug 2010, 07:13 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR