diff --git a/README.md b/README.md index 55fab8e..6d5e26e 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ ## 安装, 解压后执行 ```shell - Windows ./gocron.exe server - Linux、OSX ./gocron server + Windows ./gocron.exe web + Linux、OSX ./gocron web ``` 可选参数 + -p 端口, 指定端口, 默认5920 diff --git a/cmd/web.go b/cmd/web.go index 2d651ed..d01a0ca 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -15,8 +15,8 @@ import ( const DefaultPort = 5920 var CmdWeb = cli.Command{ - Name: "server", - Usage: "start scheduler web server", + Name: "web", + Usage: "run web server", Action: run, Flags: []cli.Flag{ cli.IntFlag{ diff --git a/models/host.go b/models/host.go index 9c8935f..7a51d14 100644 --- a/models/host.go +++ b/models/host.go @@ -10,12 +10,12 @@ import ( // 主机 type Host struct { Id int16 `xorm:"smallint pk autoincr"` - Name string `xorm:"varchar(128) notnull"` // 主机名称 + Name string `xorm:"varchar(64) notnull"` // 主机名称 Alias string `xorm:"varchar(32) notnull default '' "` // 主机别名 Username string `xorm:"varchar(32) notnull default '' "` // ssh 用户名 Password string `xorm:"varchar(64) notnull default ''"` // ssh 密码 Port int `xorm:"notnull default 22"` // 主机端口 - Remark string `xorm:"varchar(512) notnull default '' "` // 备注 + Remark string `xorm:"varchar(256) notnull default '' "` // 备注 AuthType ssh.HostAuthType `xorm:"tinyint notnull default 1"` // 认证方式 1: 密码 2: 公钥 PrivateKey string `xorm:"varchar(4096) notnull default '' "` // 私钥 BaseModel `xorm:"-"` diff --git a/models/task.go b/models/task.go index 5ed54bd..8daa4b9 100644 --- a/models/task.go +++ b/models/task.go @@ -17,14 +17,14 @@ const ( // 任务 type Task struct { Id int `xorm:"int pk autoincr"` - Name string `xorm:"varchar(64) notnull"` // 任务名称 + Name string `xorm:"varchar(32) notnull"` // 任务名称 Spec string `xorm:"varchar(64) notnull"` // crontab Protocol TaskProtocol `xorm:"tinyint notnull"` // 协议 1:http 2:ssh-command 3: 系统命令 - Command string `xorm:"varchar(512) notnull"` // URL地址或shell命令 + Command string `xorm:"varchar(256) notnull"` // URL地址或shell命令 Timeout int `xorm:"mediumint notnull default 0"` // 任务执行超时时间(单位秒),0不限制 RetryTimes int8 `xorm:"tinyint notnull default 0"` // 重试次数 HostId int16 `xorm:"smallint notnull default 0"` // SSH host id, - Remark string `xorm:"varchar(512) notnull default ''"` // 备注 + Remark string `xorm:"varchar(256) notnull default ''"` // 备注 Created time.Time `xorm:"datetime notnull created"` // 创建时间 Deleted time.Time `xorm:"datetime deleted"` // 删除时间 Status Status `xorm:"tinyint notnull default 1"` // 状态 1:正常 0:停止 diff --git a/models/task_log.go b/models/task_log.go index c0af3e9..32cd24d 100644 --- a/models/task_log.go +++ b/models/task_log.go @@ -12,17 +12,17 @@ type TaskType int8 type TaskLog struct { Id int64 `xorm:"bigint pk autoincr"` TaskId int `xorm:"int notnull index default 0"` // 任务id - Name string `xorm:"varchar(64) notnull"` // 任务名称 + Name string `xorm:"varchar(32) notnull"` // 任务名称 Spec string `xorm:"varchar(64) notnull"` // crontab Protocol TaskProtocol `xorm:"tinyint notnull"` // 协议 1:http 2:ssh-command 3:系统命令 - Command string `xorm:"varchar(512) notnull"` // URL地址或shell命令 + Command string `xorm:"varchar(256) notnull"` // URL地址或shell命令 Timeout int `xorm:"mediumint notnull default 0"` // 任务执行超时时间(单位秒),0不限制 RetryTimes int8 `xorm:"tinyint notnull default 0"` // 任务重试次数 - Hostname string `xorm:"varchar(512) notnull defalut '' "` // SSH主机名,逗号分隔 + Hostname string `xorm:"varchar(256) notnull defalut '' "` // SSH主机名,逗号分隔 StartTime time.Time `xorm:"datetime created"` // 开始执行时间 EndTime time.Time `xorm:"datetime updated"` // 执行完成(失败)时间 Status Status `xorm:"tinyint notnull default 1"` // 状态 0:执行失败 1:执行中 2:执行完毕 - Result string `xorm:"varchar(65535) notnull defalut '' "` // 执行结果 + Result string `xorm:"varchar(10000) notnull defalut '' "` // 执行结果 TotalTime int `xorm:"-"` // 执行总时长 BaseModel `xorm:"-"` }