我有一台物理服务器,它运行 8 个带有 virt-manager 和 kvm 的虚拟机。
由于不再需要一台虚拟机,我想为剩余的虚拟机提供更多资源。
我正在寻找可以帮助我找出答案的方法:
哪个虚拟机需要更多资源?
对于“资源”,我的意思是:
磁盘空间不重要,有足够的。
环境:Linux 管理程序、Linux 虚拟机
如何解决递归目录管理不保留权限的问题?
我想将(本地)中的所有文件复制/monitoring/files/etc到/etc小黄人上。
copy_files_in_etc:
file.recurse:
- source:
- salt://monitoring/files/etc
- name: /etc
- template: jinja
Run Code Online (Sandbox Code Playgroud)
上面的代码片段有效,但我缺少某些文件的可执行位。
例如 /etc/cron.daily 中的脚本应该是可执行的。
解决这个问题最简单的方法是什么?
我搜索一种方法使与此表达式匹配的所有文件都可执行:
/etc/cron.(daily|hourly|monthly|weekly/)
Run Code Online (Sandbox Code Playgroud) 我想检测 linux 发行版和版本。
我用我最喜欢的搜索引擎搜索并发现了lsb_release.
不幸的是,默认情况下未安装此工具。
我想避免先安装lsb_release。
有没有更简单的方法来以可移植的方式检测 linux 发行版和版本?
“便携式”是指不同类型的 linux 发行版。不是 *BSD 或 Windows。
如何显示所有已启用但未运行的 systemd 服务?
AFAIK“未运行”可能在两种情况下发生:
在我目前的情况下,服务是否崩溃或被明确停止并不重要。
我对 systemctl 的输出不满意
我有一个解析输出的脚本
systemctl list-units -t service --full --all
Run Code Online (Sandbox Code Playgroud)
输出的开头如下所示:
UNIT LOAD ACTIVE SUB JOB DESCRIPTION
after-local.service loaded inactive dead /etc/init.d/after.local Compatibility
? amavis.service not-found inactive dead amavis.service
apparmor.service loaded active exited Load AppArmor profiles
auditd.service loaded active running Security Auditing Service
Run Code Online (Sandbox Code Playgroud)
在不同的系统上,带点的列(在 amavis.service 之前)不存在。
systemctl 是否有机器/脚本可读的输出?
我收到这条消息,但我不知道为什么
salt:/srv # salt-ssh foo-archiv state.sls monitoring
[ERROR ] Rendering exception occurred: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has no attribute 'monitoring'
[CRITICAL] Rendering SLS 'base:monitoring' failed: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has no attribute 'monitoring'
foo-archiv:
- Rendering SLS 'base:monitoring' failed: Jinja variable 'salt.utils.context.NamespacedDictWrapper object' has no attribute 'monitoring'
Run Code Online (Sandbox Code Playgroud)
这个问题的根源是什么?
相同的 sls 文件适用于不同的主机!
为什么密码会过期?
几天以来,我一直在使用公钥(无密码)登录。今天我收到这条消息:
> ssh modlink_foo_q@server
You are required to change your password immediately (password expired)
Last login: Wed Nov 14 09:26:48 2018 from 10.130.4.3
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for modlink_foo_q.
Run Code Online (Sandbox Code Playgroud)
这是 /etc/shadow 中的匹配行
server:~ # grep modli /etc/shadow
modlink_foo_q:!:17757:1:90:7:::
Run Code Online (Sandbox Code Playgroud)
我认为没有设置密码。那么谁可以过期呢?
操作系统:SUSE Linux Enterprise Server 12 SP3
我有一个在 VM 中运行的 linux 服务器。管理程序是 VMWare。
This setup was done by a former admin:
server:~ # pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 system lvm2 a-- 119,84g 0
server:~ # vgs
VG #PV #LV #SN Attr VSize VFree
system 1 3 0 wz--n- 119,84g 0
server:~ # lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
home system -wi-ao--- 97,84g
root system -wi-ao--- 20,00g
swap system -wi-ao--- 2,00g
Run Code Online (Sandbox Code Playgroud)
I ask myself: Why?
It is great that …
如何执行到K8s节点?
到目前为止,我只找到了执行节点上运行的容器的方法。
我想避免ssh。
到目前为止,我们使用工具getmail获取新邮件。
它运作良好。有一个每分钟运行一次的 cron 作业。
有没有办法更快地收到邮件?
我看到两种方式:
解决方案1很简单:
* * * * * getmail; sleep 25; getmail
Run Code Online (Sandbox Code Playgroud)
欢迎更好的解决方案。
协议:IMAP