我正在尝试编写一个脚本,该脚本将从 apt 输出可升级包的数量。然而,它也不断给我这个警告:
# sudo apt update | grep packages | cut -d '.' -f 1
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
All packages are up to date
Run Code Online (Sandbox Code Playgroud)
我希望它只输出:
All packages are up to date
Run Code Online (Sandbox Code Playgroud)
或者
35 packages can be updated
Run Code Online (Sandbox Code Playgroud)
有什么办法可以禁用该警告吗?我将在来自 cron 作业的 Discord 通知中使用这个返回的字符串以及一些额外的信息,它非常糟糕地搞乱了我的输出。
我已经看过这些,但没有一个对我有用:
https://unix.stackexchange.com/questions/19470/list-available-updates-but-do-not-install-them
https://askubuntu.com/questions/269606/apt-get-count-the-number-of-updates-available
好的,所以我以前没有使用 SSL/HTTPS 的经验,我只处理过标准的 HTTP。最近我开始在一个需要 SSL 的网站上工作。所以当然,我已经出去研究了如何开始。我已经到了成功安装 SSL 证书的阶段 - 出现绿色挂锁,服务器响应端口 443 上的 HTTPS 请求。我遇到的问题是,无论我做什么,我都无法使用 HTTPS/ SSL,但是它们在端口 80/HTTP 上看起来很好(直到我将 HTTP 重定向到 HTTPS)。
简而言之,我完全可以访问 HTTPS 站点,但是我的页面没有被发送,而是为每个请求发送 404。
<VirtualHost *:80>
ServerName [serverName]
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
</VirtualHost>
<VirtualHost *:443>
ServerName [serverName]
ServerAdmin [email]
DocumentRoot [docRoot]
# I know the following SSL cert stuff is correct
SSLEngine On
SSLCertificateFile [...]/[domain].crt
SSLCertificateKeyFile [...]/[certificate].key
SSLCertificateChainFile [...]/[theotherone].crt
ErrorLog ${APACHE_LOG_DIR}/[custom]_error.log
CustomLog ${APACHE_LOG_DIR}/[custom]_access.log combined
<Directory "[docRoot]">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order …Run Code Online (Sandbox Code Playgroud) configuration https http-status-code-404 apache-2.4 raspbian
我正在构建一个简单的 nodejs 脚本,它根据我当前的 IP 更新 DNS 记录。该脚本工作正常,但我对如何运行它有一些担忧。必须每 5 分钟检查一次我的 IP,我正面临着两难选择。
我应该使用 Node 的setInterval还是应该创建一个 cron 作业?哪个将消耗最少的 RAM 和 CPU?请记住,该脚本在具有 512MB ram 和只有 1 个内核的 Raspberry Pi Zero 上运行。
我知道这cron似乎是一个更好的选择,但它有多好?考虑到我的规格,这很重要吗?
我试图在运行 Raspbian Buster 的 raspberry pi 上启动并运行电子邮件服务器。
在我的后缀检查中,我收到一条关于符号链接的奇怪通知,该通知绝对不是我自己创建的。警告是postfix/postfix-script: warning: symlink leaves directory: /etc/postfix/./makedefs.out
我已经做了两次干净的安装,认为它可能是恶意的,每次它回来时,所以我假设它是配置的一部分,或者与树莓派上的 postfix 版本有什么特别的关系。
无论如何,运行我的后缀检查时会出现以下消息:
sudo postfix check
postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
postfix/postfix-script: warning: symlink leaves directory: /etc/postfix/./makedefs.out
Run Code Online (Sandbox Code Playgroud)
我正在为一些自定义 Raspberry Pi 代码托管一个私有 Debian 存储库。我最初在 Raspbian Jessie(版本 8)上构建了该软件,生成了一个 GPG 密钥,我用它来签署存储库,并sudo apt-key add ...在所有设备上运行,以确保他们能够验证我的存储库。这工作正常,直到最近我添加了一些运行 Raspbian Stretch(版本 9)的新设备。即使我向它们添加了完全相同的 GPG 密钥,以下是我运行时看到的输出sudo apt-get update:
W: GPG error: http://url.of.private.repo stable Release: The following signatures were invalid: 95F9B44CE35F40B759D59C2A77E4184C595493B1
W: The repository 'http://url.of.private.repo stable Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Run Code Online (Sandbox Code Playgroud)
但是,这只发生在较新的盒子上。在仍在运行 Jessie 的 Pis 上,我可以运行sudo apt-get …
我正在尝试将我的 Raspberry Pi 3 (Raspbian) 备份到我的台式计算机 (Windows 10 Pro)。目前我可以通过各种方式 SSH,指定私钥文件。
从 Windows SSH 到 RPi:ssh root@192.168.1.107 -i H:/ssh/BB8.OpenSSH.ppk(root 以确保我在测试期间没有权限错误)。
从 RPi SSH 进入 Windows: ssh matt@192.168.1.100 -i /home/pi/.ssh/RPi3.OpenSSH.ppk
以下 rsync 命令不起作用:(Windows > RPi)
rsync -vvvvna --exclude={"/proc/*","/sys/*","/dev/*","/boot/*","/tmp/*","/run/*","/mnt/*"} -e "ssh -i H:/ssh/BB8.OpenSSH.ppk" root@192.168.1.107:/* /cygdrive/h/Users/Matt/Documents/RPi3_Backup
Run Code Online (Sandbox Code Playgroud)
Rsync 说“连接意外关闭”,而 RPi SSH 日志说它“收到来自 192.168.1.100 的断开连接”。
同步输出:
cmd=ssh -i H:/ssh/BB8.OpenSSH.ppk machine=192.168.1.107 user=root path=/*
cmd[0]=ssh cmd[1]=-i cmd[2]=H:/ssh/BB8.OpenSSH.ppk cmd[3]=-l cmd[4]=root cmd[5]=192.168.1.107 cmd[6]=rsync cmd[7]=--server cmd[8]=--sender cmd[9]=-vvvvnlogDtpre.iLsfxC cmd[10]=. cmd[11]=/*
opening connection using: ssh -i "H:/ssh/BB8.OpenSSH.ppk" -l root 192.168.1.107 …Run Code Online (Sandbox Code Playgroud) 我希望能够在apt-get upgrade没有提示的情况下无缝运行脚本,但在我的实验中,我无法让它停止显示提示,即使使用-y或--force yes。最近,当从头开始设置 RPis 时,这是一个示例,我只需点击q即可继续升级:
ca-certificates (20141019+deb8u2) stable; urgency=medium
Update Mozilla certificate authority bundle to version 2.9.
The following certificate authorities were added (+):
+ "Certplus Root CA G1"
+ "Certplus Root CA G2"
+ "Certum Trusted Network CA 2"
+ "Hellenic Academic and Research Institutions ECC RootCA 2015"
+ "Hellenic Academic and Research Institutions RootCA 2015"
+ "ISRG Root X1"
+ "OpenTrust Root CA G1"
+ "OpenTrust Root CA G2"
+ …Run Code Online (Sandbox Code Playgroud)