Article

  • 9 years

    3 months

    YetiShare / Core

    41148

Setup Cron tasks and Crontab troubleshooting

The following are cron scripts required by the core of the script for things like account downgrades, redundant file deletes etc. These processes used to be called via the website when someone visited the homepage, but it can have a negative impact on performance as your site grows.

On Your Main Website (Yetishare v5.x / uCloud v2.x)

0 0 * * * php /path/to/your/yetishare/app/tasks/auto_prune.cron.php >> /dev/null 2>&1
0 0 * * * php /path/to/your/yetishare/app/tasks/create_internal_notifications.cron.php >> /dev/null 2>&1
0 * * * * php /path/to/your/yetishare/app/tasks/delete_redundant_files.cron.php >> /dev/null 2>&1
0 0 * * * php /path/to/your/yetishare/app/tasks/downgrade_accounts.cron.php >> /dev/null 2>&1
*/5 * * * * php /path/to/your/yetishare/app/tasks/process_file_queue.cron.php >> /dev/null 2>&1
0 1 * * * php /path/to/your/yetishare/app/tasks/create_email_notifications.cron.php >> /dev/null 2>&1
* * * * * php /path/to/your/yetishare/app/tasks/process_server_resources.cron.php >> /dev/null 2>&1
* * * * * php /path/to/your/yetishare/app/tasks/process_server_monitoring.cron.php >> /dev/null 2>&1
Optional - Set this on your main file server only if you've set the option to run remote url downloads in the background (see site settings)
* * * * * php /path/to/your/yetishare/app/tasks/process_remote_file_downloads.cron.php >> /dev/null 2>&1

On Any External File Servers (if you're using 'direct' file server storage)

0 3 * * * php /path/to/your/yetishare/app/tasks/delete_redundant_files.cron.php >> /dev/null 2>&1
*/5 * * * * php /path/to/your/yetishare/app/tasks/process_file_queue.cron.php >> /dev/null 2>&1
* * * * * php /path/to/your/yetishare/app/tasks/process_server_resources.cron.php >> /dev/null 2>&1

Note: Replace /path/to/your/yetishare/ with your full server path to your yetishare installation.


How to Setup - cPanel

If you're using cPanel you can set these up via the 'crons' icon when you log into cPanel. For more information see the following url:

http://www.siteground.com/tutorials/cpanel/cron_jo...

How to Setup - crontab

If you have SSH access to your server(s) you can copy and paste the above (after changing the paths) into your server crontab. To edit the crontab:

  • Ensure you logged in as a root user.
  • Load the crontab for editing:
crontab -e
  • Copy and paste the cron lines at the bottom of that file.
  • Ensure you press the 'enter' key after the last one so you have a line break at the bottom of the file.
  • Save the file. (press ctrl+X, then Y, then enter)

Your crons should now be running.

Troubleshooting

Some things to check if you think you're having issues:

  • If the files in your "file action" queue aren't being deleted, check whether these are within the last 24 hours. File deletes are purposely put on hold for 24 hours to allow them to be recovered if needed.
  • Ensure you've setup the above crons on any external file servers.
  • Try restarting your cron service:
/etc/init.d/crond restart
  • The php alias in the crons may not work on all system. Try setting the full path to PHP instead of just php. Like this:
0 3 * * * /usr/local/lib/php /path/to/your/yetishare/admin/tasks/delete_redundant_files.cron.php >> /dev/null 2>&1
  • Other lines in the crontab file may be causing problems. Try removing these to see if your YetiShare crons now work.

Troubleshooting - File Action Queue Not Clearing

  • Ensure you've setup the crons as the root user.
  • If this is on a file server, ensure you've setup the script _config.inc.php correctly on that server. Some users set this:
    /* main configuration file for script */
    define("_CONFIG_SITE_HOST_URL", "");
    define("_CONFIG_SITE_FULL_URL", "");

    This will stop the cron from working. The correct way is:
    /* main configuration file for script */
    define("_CONFIG_SITE_HOST_URL", "fs1.yoursite.com");
    define("_CONFIG_SITE_FULL_URL", "fs1.yoursite.com");
    Replace fs1.yoursite.com with your file server domain name.

Old v4.x Crons:

Main Website
0 0 * * * php /path/to/your/yetishare/admin/tasks/auto_prune.cron.php >> /dev/null 2>&1
0 0 * * * php /path/to/your/yetishare/admin/tasks/create_internal_notifications.cron.php >> /dev/null 2>&1
0 * * * * php /path/to/your/yetishare/admin/tasks/delete_redundant_files.cron.php >> /dev/null 2>&1
0 0 * * * php /path/to/your/yetishare/admin/tasks/downgrade_accounts.cron.php >> /dev/null 2>&1
*/5 * * * * php /path/to/your/yetishare/admin/tasks/process_file_queue.cron.php >> /dev/null 2>&1
0 1 * * * php /path/to/your/yetishare/admin/tasks/create_email_notifications.cron.php >> /dev/null 2>&1
Optional - Set this on your main file server only if you've set the option to run remote url downloads in the background (see site settings)
* * * * * php /path/to/your/yetishare/admin/tasks/process_remote_file_downloads.cron.php >> /dev/null 2>&1
On Any External File Servers (if you're using 'direct' file server storage)
0 3 * * * php /path/to/your/yetishare/admin/tasks/delete_redundant_files.cron.php >> /dev/null 2>&1
*/5 * * * * php /path/to/your/yetishare/admin/tasks/process_file_queue.cron.php >> /dev/null 2>&1