AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-47111

Milliways's questions

Martin Hope
Milliways
Asked: 2019-07-28 16:43:32 +0800 CST

如何使 Wordpress 独立于主机名

  • 0

我使用 NGINX 设置了一个基本的 Wordpress 安装(在运行 Raspbian Stretch - Debian 9 的 Raspberry Pi 上)。

最近,我更改了系统的主机名(作为确保跨系统命名一致的计划的一部分),一切似乎都运行良好。

我想将我的 Wordpress 安装移动到新系统,但发现它不再工作。

基本主页出现了,但徽标等的链接不起作用。很快就变得很明显,因为链接试图访问 oldhostname.local 并且这是在 Wordpress 数据库中编码的某个地方。

我恢复了旧主机名,Wordpress 现在又可以工作了。

查看Settings/General Settings旧主机名是在Wordpress 地址 (URL)和站点地址 (URL)

我可以将其更改为我的新主机名,但理想情况下希望使其独立于主机名。(Raspberry Pi 的一个方面是克隆 SD 卡很简单,我只需更改主机名即可将我的安装复制到其他人)。

我的问题是我可以让 Wordpress 安装独立于主机名,如果可以,如何?

hostname wordpress
  • 1 个回答
  • 43 Views
Martin Hope
Milliways
Asked: 2019-02-08 20:00:29 +0800 CST

防止 cron 发送错误消息

  • 0

我已将 cron 设置为每 15 分钟为用户 pi 运行一个任务(在我的 Raspberry Pi 上运行 Raspbian Stretch)。

6,21,36,51 * * * * /usr/bin/mosquitto_sub -h Pi3Plus.local -v -C 1 -t weather >> weather.log

我还设置了 ssmtp 以通过 gmail 发送电子邮件。

cron 任务经常无法连接到服务器,并生成错误消息。

问题是它然后尝试向用户 pi 发送一条消息,该 ssmtp 更改为 pi@gmail 并发送到 gmail,但它失败了。

我已经阅读了 ssmtp、ssmtp.conf、cron、crontab 的手册,但找不到任何东西来阻止这些消息。

我可以编写一个脚本来捕获 cron 任务中的错误消息,以防止它产生错误。

cron ssmtp
  • 2 个回答
  • 562 Views
Martin Hope
Milliways
Asked: 2019-01-16 16:49:45 +0800 CST

我似乎无法在 MQTT 中配置持久性

  • 0

我正在运行 Raspbian 的 Raspberry Pi 上尝试 MQTT。基本设置有效,但我似乎无法配置持久性。

关注https://tutorials-raspberrypi.com/raspberry-pi-mqtt-broker-client-wireless-communication/

我安装了mosquitto mosquitto-clients

我在后台进程中安装paho-mqtt并运行以下脚本,以从连接的传感器发布温度和湿度读数。

#!/usr/bin/python3
import os
import time
import sys
import Adafruit_DHT as dht
import paho.mqtt.client as mqtt
import json
import datetime
#
# Sensor should be set to Adafruit_DHT.DHT11, Adafruit_DHT.DHT22, or Adafruit_DHT.AM2302.
sensor = dht.DHT11
pin = 4

BROKER = 'localhost'

# Data capture and upload interval in seconds.
INTERVAL=15

sensor_data = {'date': 0, 'temperature': 0, 'humidity': 0}

next_reading = time.time()

client = mqtt.Client()

# Connect to BROKER using default MQTT port and 60 seconds keepalive interval
client.connect(BROKER, 1883, 60)

client.loop_start()

try:
    while True:
        humidity,temperature = dht.read_retry(sensor, pin)
        humidity = round(humidity, 2)
        temperature = round(temperature, 2)
        print(u"Temperature: {:g}\u00b0C, Humidity: {:g}%".format(temperature, humidity))
        sensor_data['temperature'] = temperature
        sensor_data['humidity'] = humidity
        sensor_data['date'] = datetime.datetime.now().replace(microsecond=0).isoformat()

#         client.publish('test_channel', json.dumps(sensor_data), 1)
        client.publish('test_channel', json.dumps(sensor_data), 2)

        next_reading += INTERVAL
        sleep_time = next_reading-time.time()
        if sleep_time > 0:
            time.sleep(sleep_time)
except KeyboardInterrupt:
    pass

client.loop_stop()
client.disconnect()

这有效,我可以在另一个 Pi 上看到消息,mosquitto_sub -h IPaddress -v -t test_channel但这仅在进程运行时有效。我希望代理保存消息,直到订阅者连接。

我在文件中添加了“persistence true”,/etc/mosquitto/conf.d/Milliways.conf日志文件显示如下消息

1547597521: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.

该数据库似乎不包含任何相关数据。

我已阅读https://pypi.org/project/paho-mqtt/#publishing和manfor mosquitto 上的文档。

mqtt
  • 1 个回答
  • 228 Views
Martin Hope
Milliways
Asked: 2018-10-17 20:22:50 +0800 CST

Arch-ARM 上的 SFTP 问题

  • 0

我在 Raspberry Pi 3 上安装了 Arch ARM 并创建了一个新用户。几乎一切正常;我已经复制了我的公钥/私钥,并且可以 ssh 到 Raspberry Pi 上的 Arch。

注意我只是尝试在我的本地网络上连接。

但是我似乎无法通过 FTP 进入服务器。我在 macOS 上使用最新的 Filezilla,而 Arch ARM 是最新的。我在 Filezilla 中使用 SFTP,其设置与我在 Pi 上连接 Raspbian 时使用的设置相似。

以下是连接尝试的消息日志

Status:         Connecting to archpi.local...
Status:         Connected to archpi.local
Error:          Received unexpected end-of-file from SFTP server
Error:          Could not connect to server
Status:         Waiting to retry...
Status:         Connecting to archpi.local...
Response:   fzSftp started, protocol_version=8
Command:    open "[email protected]" 22
Command:    Pass: *******
Status:         Connected to archpi.local
Error:          Received unexpected end-of-file from SFTP server
Error:          Could not connect to server
raspberry-pi sftp
  • 1 个回答
  • 498 Views
Martin Hope
Milliways
Asked: 2018-10-13 18:12:27 +0800 CST

Arch ARM 设置时区

  • 0

我已经从 rasparch-exton-1680mb-180402.zip 在我的 Raspberry Pi 上安装了 Arch Linux,成功更新并将我的语言环境设置为 en_AU.UTF-8,这看起来不错。

timedatectl 继续显示时区:UTC

timedatectl set-timezone AEDT返回无效的时区

timezone arch-arm
  • 1 个回答
  • 373 Views
Martin Hope
Milliways
Asked: 2018-06-11 18:34:39 +0800 CST

rsync 因多个 SRC 而失败

  • 2

我通过 ssh 登录到 Mac(运行 OSX 10.12)并输入了以下命令。

REMOTE=Milliways.local:/Users/ian
rsync -a --delete-during $REMOTE/bin ~/
rsync -a --delete-during $REMOTE/Documents ~/

这工作正常,并更新适当的目录。

我尝试使用以下方法将两个目录包含在一个 rsync 中:-

rsync -a --delete-during $REMOTE/bin  $REMOTE/Documents ~/

这会产生一条错误消息(基本上是我从 rsync -h 得到的消息)

~$ rsync -a --delete-during $REMOTE/bin  $REMOTE/Documents ~/
rsync  version 2.6.9  protocol version 29
Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
              inplace, IPv6, 64-bit system inums, 64-bit internal inums
…

我研究了 man 文件,它们似乎支持我正在尝试的内容,特别是

Usage: rsync [OPTION]... SRC [SRC]... DEST

虽然对于这些目录,我没有真正的理由需要合并,但对于其他目录,我需要使用单个 SRC 来维护硬链接。

任何人都可以提出什么问题吗?

正如 muru 的回答中所建议的,我安装了 brew。

rsync osx
  • 1 个回答
  • 274 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve