travelport-czech/tpcrontools

用于管理cron任务的工具。

1.0.1 2020-02-21 08:43 UTC

This package is not auto-updated.

Last update: 2024-09-14 07:49:55 UTC


README

  • cronctl - 向用户crontab中添加或删除任务

cronctl

usage: cronctl [-h] (--list | --add TYPE | --remove) [-f] path [path ...]

Tool for manage jobs in crontab

positional arguments:
  path         Path to folder with job scripts

optional arguments:
  -h, --help   show this help message and exit
  --list       List all robots sorted by type
  --add TYPE   Add jobs of the appropriate type from the specified path
  --remove     Remove all jobs with given path
  -f, --force  Store changes into crontab without confirmation

Example of job file header:
  #!/usr/bin/env bash

  #PT:cron:10 1,2,3,4 * * *
  #PDI:cron:40 5,6,7,8 * * *

With this example "cronctl --add I /robots/scripts" adds to the current user's crontab row:
40 5,6,7,8 * * * /robots/scripts/example.sh

例如,如果您想从文件夹/opt/robots中添加生产任务

  cronctl --add P /opt/robots

如果我们想从文件夹/opt/alpha/robots中卸载所有任务(因为我们的应用程序从alpha阶段移动到beta阶段)

  cronctl -f --remove /opt/alpha/robots