我正在尝试创建一个systemd
服务;
该服务有一个脚本,应该使用一些环境变量;
所以我创建了这个:
cat /etc/systemd/system/atlantis-server.service
[Service]
ExecStart=/usr/local/bin/atlantis-server.sh
Run Code Online (Sandbox Code Playgroud)
哪个指向这个
pkara@atlantis-server:~$ cat /usr/local/bin/atlantis-server.sh
#!/bin/bash
source /etc/environment
atlantis server --atlantis-url="$URL" --gitlab-user="$USERNAME" --gitlab-token="$TOKEN" --gitlab-webhook-secret="$SECRET" --gitlab-hostname="$HOSTNAME" --repo-whitelist="$REPO_WHITELIST"
Run Code Online (Sandbox Code Playgroud)
我注意到(在我的systemd
日志中出现一些错误之后)是我必须明确source /etc/environment
(这是声明上述变量的地方)。
为什么需要这个?
它们不是全局可见的吗?
编辑:将此添加到服务定义并没有解决问题
Environment=/etc/environment
Run Code Online (Sandbox Code Playgroud) 为什么在以下(e)grep
尝试中,egrep
无法识别字尾分隔符?( b
)?
$ echo -n "my-pc is beautiful" | egrep 'my-pc\b'
my-pc is beautiful
/home/pkaramol
$ echo -n "my-pc-vol2 is beautiful" | egrep 'my-pc\b'
my-pc-vol2 is beautiful
Run Code Online (Sandbox Code Playgroud)
与plain 的结果相同grep
吗?
\xce\x99 am nc 监听localhost:2500
\xe2\x96\xb6 nc -l 2500\n_\n
Run Code Online (Sandbox Code Playgroud)\n在另一个终端上,我尝试连接到这个监听端
\n\xe2\x96\xb6 nc -zv localhost 2500\nnc: connectx to localhost port 2500 (tcp) failed: Connection refused\nConnection to localhost port 2500 [tcp/rtsserv] succeeded!\n
Run Code Online (Sandbox Code Playgroud)\n为什么第一次尝试似乎失败了?
\n我还注意到,当连接尝试由于某种原因完成(显然成功)时,我的监听进程将退出。不知道为什么会发生这种情况。
\n我有以下字符串bash
"3.8,3.9,3.10"
Run Code Online (Sandbox Code Playgroud)
有没有办法使用shell将其转换为json
数组,即
["3.8", "3.9", "3.10"]
Run Code Online (Sandbox Code Playgroud) 我能够使用objectClass的userPrincipalName
属性登录到 Active Directory user
;(例如foo@mydomain.com
)
我还设置了一个OpenLDAP
服务器实例,我只能使用dn
,例如
"cn=somecn,cn=anothercn,ou=someou,dc=mydomain,dc=com"
如何OpenLDAP
使用另一个字段进行身份验证,例如,例如的mail
属性inetOrgPerson
?
更重要的是,即使这样的事情是可能的,任何人如何确保该领域的独特性?(我假设 AD 在该userPrincipalName
领域提供了一个功能)
从iostat
手册页:
rrqm/s
The number of read requests merged per second that were queued to the device.
wrqm/s
The number of write requests merged per second that were queued to the device.
r/s
The number (after merges) of read requests completed per second for the device.
w/s
The number (after merges) of write requests completed per second for the device.
Run Code Online (Sandbox Code Playgroud)
merge
由于文档没有提供任何进一步的细节,任何人都可以详细说明这个概念吗?
我将 设置umask
为一个新值,如下所示。但是,尽管我正在rxw
向用户申请,但这似乎并没有得到尊重(?)
/home/pkaramol
$ umask u=rxw,g=rw,o=r
/home/pkaramol
$ umask -S
u=rwx,g=rw,o=r
/home/pkaramol
$ rm -rf afile && touch afile;
/home/pkaramol
$ ls -l afile
-rw-rw-r-- 1 pkaramol pkaramol 0 ?ar 2 10:30 afile
Run Code Online (Sandbox Code Playgroud)
编辑:
$ mount | grep -E '\s/\s'
/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
$ mount | grep -i home
/home/pkaramol
Run Code Online (Sandbox Code Playgroud) 我知道有几个关于在alpine
.
但是有没有办法列出已经受信任的根 CA alpine
?
我正在使用以下脚本,以便调用一个应该迭代数组的函数。
#!/bin/bash
function iterarr {
for item in "$1"
do
echo "$item"
done
}
myarr=(/dir1/file1.md /dir1/file2.md README.md)
iterarr "${myarr[@]}"
Run Code Online (Sandbox Code Playgroud)
但是,当我执行它时,它会给出以下输出。
/dir1/file1.md
为什么它只打印第一个数组条目?
编辑:更重要的是,我希望能够使用附加参数(除了数组之外,所以如果我使用“$@”,如何访问第二个参数?)
Ubuntu 16.04.03
与...一起工作
*$ $(which bash) --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Run Code Online (Sandbox Code Playgroud) 根据官方 QEMU文档:
当用作虚拟器时,QEMU 通过直接在主机 CPU 上执行来宾代码来实现接近本机的性能。
我的问题是这种行为与我们称为管理程序的程序(例如 VirtualBox、KVM 等)有何不同?他们不是也在“主机 CPU”上运行“访客代码”吗?他们还会在哪里运行它?
更新:
如果下图(源)是正确的,那么事实证明 QEMU 运行应用程序(而不是像管理程序这样的整个操作系统),但在不同架构类型之间执行转换(例如,为 ARM 编写的程序可以在 x86 上运行)
鉴于上述情况,运行的情况是:
a) 特定架构(例如 ARM)的整个操作系统
b) 在具有不同架构的主机上(例如 amd64)
两者都需要共存
QEMU(执行跨架构映射)
和
KVM(充当硬件管理程序)
需要吗?