django-crontab同一主机和用户上的多个项目

序言1:当同一个主机上有多个项目并且出现项目名字一致时,进行python manage.py crontab add会出现异常:
序言2:当服务器存在原来的定时任务,如果对原来的定时任务的日志路径进行修改,进行python manage.py crontab add也会出现如下异常,解决方法:在代码pull之前先将任务去除python manage.py crontab remove,如果已经pull下来了,可以执行 crontab -e 对定时任务进行修改成新的一致,然后进行任务创建
    'Run "python manage.py crontab add" again to resolve this issue!' % job_hash
RuntimeError: No job with hash 93db807d32a4da67c4524a4b25422208 found. It seems the crontab is out of sync with your settings.CRONJOBS. Run "python manage.py crontab add" again to resolve this issue!
CRONTAB_COMMENT
  • used for marking the added contab-lines for removing, default value includes project name to distinguish multiple projects on the same host and user
  • default: ‘django-crontabs for ‘ + CRONTAB_DJANGO_PROJECT_NAME
  • 用于标记添加的和要删除的contab行,默认值包括项目名称,以区分同一主机和用户上的多个项目
  • 默认值:'django-crontabs for'+ CRONTAB_DJANGO_PROJECT_NAME
    如果两个项目名字一致会导致无法区别
    CRONTAB_COMMENT = '新的自己命名'
    image.png
CRONTAB_LOCK_JOBS
  • prevent starting a job if an old instance of the same job is still running
  • default: False
  • since 0.5.0
  • 如果同一作业的旧实例仍在运行,则阻止启动该作业
  • 默认值:False
  • 自0.5.0
CRONTAB_EXECUTABLE
  • path to the crontab executable of your os
  • default: ‘/usr/bin/crontab’
  • 操作系统的crontab可执行文件的路径
  • 默认值:'/ usr / bin / crontab'
CRONTAB_DJANGO_PROJECT_NAME
  • the name of your django project, used to build path path to manage.py and to mark the jobs in contrab via comment for later removing
  • default is read from DJANGO_SETTINGS_MODULE environment variable
  • django项目的名称,用于建立路径manage.py的路径,并通过注释将工作标记为禁忌,以便以后删除
  • 默认是从DJANGO_SETTINGS_MODULE环境变量读取的
CRONTAB_DJANGO_MANAGE_PATH
  • path to manage.py file (including the manage.py itself, i.e. ‘/home/john/web/manage.py’)
  • default is build using DJANGO_PROJECT_NAME
  • manage.py文件的路径(包括manage.py本身,即'/home/john/web/manage.py')
  • 默认为使用DJANGO_PROJECT_NAME构建
CRONTAB_DJANGO_SETTINGS_MODULE
  • dotted python path to the settings module to run the command with
  • default is the common one from the environment variable and will not be overwritten
  • since 0.6.0
  • 设置模块的点分python路径,以运行命令
  • 默认是环境变量中的通用变量,不会被覆盖
  • 自0.6.0
CRONTAB_PYTHON_EXECUTABLE
  • path to the python interpreter executable used to run the scheduled job
  • default uses the interpreter executable used to add the jobs (via ‘python manage.py crontab add’)
  • 用于运行计划作业的python解释器可执行文件的路径
  • 默认使用用于添加作业的解释器可执行文件(通过“ python manage.py crontab add”)
CRONTAB_COMMAND_PREFIX
  • something you wanne do or declare before each job gets executed. A good point for environment variables.

  • default: ‘’ (empty string)

  • example: ‘STAGE=production’

  • 您希望在执行每个作业之前执行或声明的操作。环境变量的一个好地方。

  • 默认值:''(空字符串)

  • 示例:“ STAGE = production”

CRONTAB_COMMAND_SUFFIX
  • something you wanne do after each job was executed.
  • default: ‘’ (empty string)
  • example: ‘2>&1’
  • 每个工作执行完后您想做的事情。
  • 默认值:''(空字符串)
  • 例如:“ 2>&1”

你可能感兴趣的:(django-crontab同一主机和用户上的多个项目)