Commit e9a3f50d by 孙龙

up

parent eab8f8bf
Showing with 19 additions and 15 deletions
...@@ -35,14 +35,15 @@ func main(){ ...@@ -35,14 +35,15 @@ func main(){
//kv.Delete(context.TODO(),"/cron/jobs/192.168.2.246/job1",clientv3.WithPrefix()) //kv.Delete(context.TODO(),"/cron/jobs/192.168.2.246/job1",clientv3.WithPrefix())
//kv.Delete(context.TODO(),"/cron/jobs",clientv3.WithPrefix()) //kv.Delete(context.TODO(),"/cron/jobs",clientv3.WithPrefix())
//kv.Delete(context.TODO(),"/cron/oncejobs",clientv3.WithPrefix())
//
//return //return
//新增定时任务 //新增定时任务
//putResp, err := kv.Put(context.TODO(),"/cron/jobs/192.168.2.232/job2","{\"name\":\"job2\",\"command\":\"D:/phpstudy/PHPTutorial/php/php-5.6.27-nts/php E:/WWW/a.php\",\"cronExpr\":\"*/7 * * * * * *\"}",clientv3.WithPrevKV()) //putResp, err := kv.Put(context.TODO(),"/cron/jobs/192.168.2.232/job2","{\"name\":\"job2\",\"command\":\"D:/phpstudy/PHPTutorial/php/php-5.6.27-nts/php E:/WWW/a.php\",\"cronExpr\":\"*/7 * * * * * *\"}",clientv3.WithPrevKV())
//putResp, err := kv.Put(context.TODO(),"/cron/jobs/192.168.2.246/job2","{\"name\":\"job2\",\"command\":\" echo hello world\",\"cronExpr\":\"*/5 * * * * * *\"}",clientv3.WithPrevKV()) //putResp, err := kv.Put(context.TODO(),"/cron/jobs/192.168.2.246/job2","{\"name\":\"job2\",\"command\":\" echo hello world\",\"cronExpr\":\"*/5 * * * * * *\"}",clientv3.WithPrevKV())
putResp, err := kv.Put(context.TODO(),"/cron/jobs/192.168.2.246/job3","{\"name\":\"job3\",\"command\":\" echo hello boy\",\"cronExpr\":\"*/10 * * * * * *\"}",clientv3.WithPrevKV()) //putResp, err := kv.Put(context.TODO(),"/cron/jobs/192.168.2.246/job3","{\"name\":\"job3\",\"command\":\" echo hello boy\",\"cronExpr\":\"*/10 * * * * * *\"}",clientv3.WithPrevKV())
//fmt.Println(putResp) //fmt.Println(putResp)
//fmt.Println(err) //fmt.Println(err)
...@@ -53,17 +54,17 @@ func main(){ ...@@ -53,17 +54,17 @@ func main(){
//强杀任务 //强杀任务
//putResp, err := kv.Put(context.TODO(),"/cron/killer/192.168.2.246/job10","") //putResp, err := kv.Put(context.TODO(),"/cron/killer/192.168.2.246/job10","")
//
if err != nil{ //if err != nil{
fmt.Println(err) // fmt.Println(err)
}else{ //}else{
fmt.Println("Revision:",putResp.Header.Revision) // fmt.Println("Revision:",putResp.Header.Revision)
if putResp.PrevKv != nil{ // if putResp.PrevKv != nil{
fmt.Println("key:",string(putResp.PrevKv.Key)) // fmt.Println("key:",string(putResp.PrevKv.Key))
fmt.Println("Value:",string(putResp.PrevKv.Value)) // fmt.Println("Value:",string(putResp.PrevKv.Value))
fmt.Println("Version:",string(putResp.PrevKv.Version)) // fmt.Println("Version:",string(putResp.PrevKv.Version))
} // }
} //}
//查询 //查询
getResp,err = kv.Get(context.TODO(),"/cron/jobs",clientv3.WithPrefix()) getResp,err = kv.Get(context.TODO(),"/cron/jobs",clientv3.WithPrefix())
......
go run .\worker\main\worker.go -config=./worker\main\worker.json go run .\worker\main\worker.go -config=./worker\main\worker.json
\ No newline at end of file
go build -o {path}/cmd/worker {path}/worker/main/worker.go
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment