小编Pri*_*iya的帖子

如何终止 kubernetes 后台运行的端口转发进程

我已使用以下命令转发所有 postgres 服务

kubectl port-forward svc/data-postgres 5432:5432 &
Run Code Online (Sandbox Code Playgroud)

我现在想终止这个进程。我尝试了以下命令:

ps ax | egrep port-forward | egrep 'postgres' | sed 's/^\s*//' | cut -d' ' -f1 | xargs kill
Usage:
 kill [options] <pid> [...]

Options:
 <pid> [...]            send signal to every <pid> listed
 -<signal>, -s, --signal <signal>
                        specify the <signal> to be sent
 -l, --list=[<signal>]  list all signal names, or convert one to a name
 -L, --table            list all signal names in a nice table

 -h, --help     display this help and …
Run Code Online (Sandbox Code Playgroud)

linux

6
推荐指数
1
解决办法
5927
查看次数

如何使用 python 脚本将点分隔字符串转换为 yaml 格式

我有一个具有某些属性 myprop.properties 的文件

a.b.c.d : '0'
a.b.c.e : 'hello'
a.b.c.f : 'hello1'
a.b.g.h : '123'
a.b.g.i : '4567'
http_port : false
install_java : true
Run Code Online (Sandbox Code Playgroud)

我想将此文件转储为 yaml 格式,因此预期输出应该是:

a:
 b:
  c:
  - d: '0'
    e: hello
    f: hello1
  g:
  - h: '123'
    i: '4567'
http_port : false
install_java : true
Run Code Online (Sandbox Code Playgroud)

python pyyaml python-3.x ruamel.yaml

3
推荐指数
1
解决办法
2060
查看次数

标签 统计

linux ×1

python ×1

python-3.x ×1

pyyaml ×1

ruamel.yaml ×1