Crontab syntax

Discussion in 'General' started by t-mug, May 12, 2009.

  1. t-mug

    t-mug New Member

    You can select multiple values for cronjob time columns, even the placeholder * for "all" - now see this pic:
    It happens although the following code in the file ispconfig_cron.lib.php seems to try to clear this:
    foreach($user_crons as $user_cron){
    $user_cron['cron_active'] && $user_cron['status']){
    strpos($user_cron['cron_minutes'], '*') === true$user_cron['cron_minutes'] = '*';
    strpos($user_cron['cron_hours'], '*') === true$user_cron['cron_hours'] = '*';
    strpos($user_cron['cron_days'], '*') === true$user_cron['cron_days'] = '*';
    strpos($user_cron['cron_months'], '*') === true$user_cron['cron_months'] = '*';
    strpos($user_cron['cron_weekdays'], '*') === true$user_cron['cron_weekdays'] = '*';
    $cron_jobs[] = '#'.$user_cron['doc_id'].' '.$user_cron['cron_name'];
    $cron_jobs[] = $user_cron['cron_minutes'].' '.$user_cron['cron_hours'].' '.$user_cron['cron_days'].' '.$user_cron['cron_months'].' '.$user_cron['cron_weekdays'].' '.$user_cron['cron_command'];
    But the function strpos() never returns exactly TRUE; it returns the position of the needle as an int or it returns FALSE. So the solution is to replace all the "=== TRUE" with either "!== FALSE" or with "=== 0" (no other position than 0 is possible in this case).

    Maybe I'm wrong. Otherwise this is for the bugtracker - thanks.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post this to the bugtracker.

    I guess it has to use either "strstr" instead of strpos or the solution you suggested.

Share This Page