11 2020 档案

python中的eval 和 exec 和 execfile
摘要:#eval 函数用来计算python表达式并返回结果#exec 可以执行动态的python代码,不返回结果 def hello(): print("hello world") eval("hello()") 输出 hello world exec("hello()") 输出 hello world# 阅读全文

posted @ 2020-11-27 22:12 思此狂 阅读(316) 评论(0) 推荐(0) 编辑

cloud-init 常见问题
摘要:1 日志文件都放在了哪里 1 /var/log/cloud-init.log2 服务的输出 systemd 启动的系统可以查看 journalctl 日志 sysvinit/upstart 启动的系统应该在 /var/log/cloud-init-output.log 里,这块我需要确认下 如何收集 阅读全文

posted @ 2020-11-21 20:20 思此狂 阅读(2737) 评论(0) 推荐(0) 编辑

systemd
摘要:systemd-cgls 指令,根据 cgroup 将运行的进程分组来同时实现两者。 要显示您系统中的全部 cgroup 层级systemd-cgls 查看 memory 资源管控器的 cgroup 树systemd-cgls memorysystemd-cgls cpusystemd-cgls d 阅读全文

posted @ 2020-11-20 20:15 思此狂 阅读(241) 评论(0) 推荐(1) 编辑

cloud-init 的命令行
摘要:各服务对应的 cloud-init 执行的命令行 cloud-init-local.service : cloud-init init --local cloud-init.service: cloud-init init cloud-config.service: cloud-init modul 阅读全文

posted @ 2020-11-15 21:48 思此狂 阅读(767) 评论(0) 推荐(0) 编辑

cloud-init 基本介绍
摘要:cloud-init 主要是为了初始化实例信息,用户在购买实例时配置的实例密码,Hostname,user-data等,及实例启动时系统配置,如 repo源,ssh认证密钥等。 cloud-init 在启动时分5个阶段执行,对应于系统中服务分别是 1 Generator 2 Local 对应系统服务 阅读全文

posted @ 2020-11-15 21:30 思此狂 阅读(4611) 评论(0) 推荐(1) 编辑

python导入py文件模块
摘要:有时我们写了一些lib文件,想作为模块导入引用 python import导入模块时搜索模块文件路径在 sys.path 在root下执行的 t.py (print sys.path) ['/root', '/usr/lib64/python27.zip', '/usr/lib64/python2. 阅读全文

posted @ 2020-11-14 23:51 思此狂 阅读(1757) 评论(0) 推荐(0) 编辑

python堆栈追踪异常
摘要:以前常用的写法 try: print(a) except Exception, e: print("err exception is %s" % e) 输出 err exception is name 'a' is not defined 异常打印信息不明显 推荐 traceback 来追踪异常 i 阅读全文

posted @ 2020-11-14 23:44 思此狂 阅读(206) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示