Azure WebJob不接受有效的(?)CRON表达式

时间:2016-06-15 13:13:41

标签: azure cron azure-webjobs cronexpression

我使用crontab.guru创建了一个非常简单的CRON表达式,每天在3:15(AM)执行所需的行为,结果如下:15 3 * * *

Crontab.guru

对我来说不幸的是,Azure Portal这不起作用,但如果我向我的表达式0添加一个前导0 15 3 * * *,Azure将接受它,而{{1}会告诉我这是错的。根据{{​​1}}的规范是:分钟工作日的分钟日期

Azure does not accept my CRON expression

Azure accepts the expression with a leading zero

问题..

  • 从何处出现差异?
  • 微软是否以传统方式拥有专有权 实现领先零?
  • 如果标准是分钟日期月工作日,那么该怎么办? 领先的零描述?

1 个答案:

答案 0 :(得分:11)

查看文档:

  

CRON表达式由6个字段组成:{second} {minute} {hour} {day} {month} {week of the week}。

所以第一个0描述秒。

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.graphics.Rect;


public class gameScreen extends AppCompatActivity {

    //Global variable declarations
    Button quit_button;
    Button pause_button;
    String aviChoice;
    String aviMF_choice;
    ImageView aviCharacter, aviBase;
    Handler handler0 = new Handler();
    Handler handler1 = new Handler();
    Handler handler2 = new Handler();
    Handler handler3 = new Handler();
    float aviHeightLimit, jumpDeltaY;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gamescreen);

        Bundle extras = getIntent().getExtras();
        if(extras != null)
        {
            aviChoice = extras.getString(aviMF_choice);
        }

        jumpDeltaY = 10;
        aviCharacter = (ImageView) findViewById(R.id.aviCharacter_img);
        final Rect aviCharacterRect = new Rect();
        aviCharacter.getHitRect(aviCharacterRect);
        aviBase = (ImageView) findViewById(R.id.aviBase_img);
        final Rect aviBaseRect = new Rect();
        aviBase.getHitRect(aviBaseRect);

        aviHeightLimit = aviBase.getY() - 150;
        aviCharacter.setY(aviBase.getY() - 25);

        aviBase.setBackgroundResource(R.drawable.bouncebase);
        if(aviChoice.equals("male"))
        {
            aviCharacter.setBackgroundResource(R.drawable.avimstandard);
        }
        if(aviChoice.equals("female"))
        {
            aviCharacter.setBackgroundResource(R.drawable.avifstandard);
        }


        //Runnables ================================================================================
        Runnable aviJumping = new Runnable() {
            @Override
            public void run() {
                if(aviCharacter.getY() < aviHeightLimit)
                {
                    jumpDeltaY = -jumpDeltaY;
                }
                if(Rect.intersects(aviBaseRect, aviCharacterRect))
                {
                    Log.i("test", "intersection detected old");
                    jumpDeltaY = -jumpDeltaY;
                }
                if(aviCharacterRect.intersect(aviBaseRect))
                {
                    Log.i("test", "intersection detected new");
                    jumpDeltaY = -jumpDeltaY;
                }
                aviCharacter.setY(aviCharacter.getY() + jumpDeltaY);
                Log.i("test", ""+Rect.intersects(aviCharacterRect,aviBaseRect));
                handler0.postDelayed(this, 100);
            }
        };
        handler0.postDelayed(aviJumping,100);
        //==========================================================================================
    }