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
    • 最新
    • 标签
主页 / server / 问题

问题[service](server)

Martin Hope
Souad
Asked: 2023-04-26 22:15:38 +0800 CST

设备关闭。找不到服务

  • 5

我正在尝试在 Redhat 服务器中设置 2 个在启动时启动数据库并在关闭时停止的服务,因此我将 2 个文件放在如下位置/etc/systemd/system:

关机服务:

[Unit]
Description=Shutdown database at shutdown
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target

[Service]
Type=oneshot
ExecStart=/usr/DBA/shutdown.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

启动服务:

[Unit]
Description=Start   database at startup after network becomes reachable
After=default.target

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/usr/DBA/startup.sh
TimeoutStartSec=0

[Install]
WantedBy=default.target

然后我做了这些命令:

sudo systemctl daemon-reload
sudo systemctl enable startup.service
sudo systemctl enable shutdown.service
sudo systemctl start startup.service
sudo systemctl start shutdown.service

然后当我查看状态时,它们工作正常并显示活动和运行。然后我重新启动服务器,我再次检查状态,但我得到了这个:

[ec2-user@ip-10-193-117-56 system]$ sudo systemctl status shutdown.service
Unit shutdown.service could not be found.
[ec2-user@ip-10-193-117-56 system]$ sudo systemctl status startup.service
Unit startup.service could not be found.
[ec2-user@ip-10-193-117-56 system]$

所以我不明白,这是什么问题。为什么重启服务器后找不到服务?它们应该被启用并启动一次,然后它们应该自动启动。

任何想法 ?

以下是文件夹中的两项服务:

cd /etc/systemd/system
ls -l
-rw-rw-r--. 1 root root  246 Feb 22 16:02  startup.service
-rw-rw-r--. 1 root root  255 Feb 22 16:02  shutdown.service
service
  • 1 个回答
  • 23 Views
Martin Hope
Uhl Hosting
Asked: 2022-10-14 05:33:30 +0800 CST

SystemD memcached 服务 - (code=exited, status=1/FAILURE)

  • 0

所以我不得不在 /var/run/memcached 中使用 SOCKET 部署 Rocky Linux 8 memcached

为了避免服务失败,我运行了以下命令:

  • systemctl 编辑 memcached.service

粘贴在:

[Unit]
Description=Memcached
Before=httpd.service
After=network.target
[Service]
Type=simple
User=memcached
Group=memcached
# Run ExecStartPre with root-permissions
ExecStartPre=-/usr/bin/mkdir /var/run/memcached
ExecStartPre=-/usr/bin/chown -R memcached:memcached /var/run/memcached/
[Install]
WantedBy=multi-user.target

[root@cp monit.d]# service memcached status
Redirecting to /bin/systemctl status memcached.service
● memcached.service - Memcached
   Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/memcached.service.d
           └─override.conf
   Active: active (running) since Thu 2022-10-13 15:23:50 CEST; 3s ago
  Process: 1336192 ExecStartPre=/usr/bin/chown -R memcached:memcached /var/run/memcached/ (code=exited, status=0/SUCCESS)
  Process: 1336188 ExecStartPre=/usr/bin/mkdir /var/run/memcached (code=exited, status=1/FAILURE)
 Main PID: 1336194 (memcached)
    Tasks: 10 (limit: 101049)
   Memory: 3.6M
   CGroup: /system.slice/memcached.service
           └─1336194 /usr/bin/memcached -p 11211 -u memcached -m 256 -c 1024 -s /var/run/memcached/memcached.sock -a 0770

Oct 13 15:23:50 cp.uhlhosting.ch systemd[1]: Starting Memcached...
Oct 13 15:23:50 cp.uhlhosting.ch systemd[1]: Started Memcached.

有什么方法可以避免这种失败?

ExecStartPre=/usr/bin/mkdir /var/run/memcached (code=exited, status=1/FAILURE)

谢谢!

service systemd
  • 1 个回答
  • 10 Views
Martin Hope
shantanuo
Asked: 2022-08-12 20:41:03 +0800 CST

更改本地主机设置

  • 0

我按照这篇博文中提到的步骤..

https://aws.amazon.com/blogs/opensource/dashboards-as-code-a-new-approach-to-visualizing-aws-apis/

并能够启动服务。

$ steampipe dashboard
[ Wait    ] Loading Workspace
[ Wait    ] Starting Dashboard Server
[ Message ] Workspace loaded
[ Message ] Initialization complete
[ Ready   ] Dashboard server started on 9194 and listening on local
[ Message ] Visit http://localhost:9194
[ Message ] Press Ctrl+C to exit

但我需要将它托管在 some-company.com:9194 而不是 localhost 上。那可能吗?

service
  • 0 个回答
  • 42 Views
Martin Hope
Windscale
Asked: 2022-04-09 06:33:25 +0800 CST

systemd ExecStart、ExecStop 子句中的环境变量未按预期工作

  • 0

我正在为一些 systemd 服务处理一些单元文件。我的一些二进制文件的路径前缀很长,它们在 ExecStart=、ExecStartPost= 和 ExecStop= 子句中多次使用。

我定义了一些环境变量(也需要传递给服务),例如:

Environment=ORACLE_HOME=/u01/app/oracle/product/19/db_1

我相信,从 systemd.service(5) 的“命令行”部分,我应该能够在 Exec*= 子句中使用变量扩展 - 例如:

ExecStart=${ORACLE_HOME}/bin/dbstart

当我尝试这样做并执行 systemctl daemon-reload 时,我在日志中收到以下错误:

systemd[1]: [/usr/lib/systemd/system/oracle.service:37] Executable path is not absolute, ignoring: ${ORACLE_HOME}/bin/dbstart /u01/app/oracle/product/19/db_1

systemd 文档非常清楚,要运行的文件的路径必须以 / 开头(允许的前缀除外),但是我缺少的语法是否有一些细微差别可以让我做我想做的事?

最终,我想要包含使用的环境变量的文件,以便它们可以在 systemd 单元文件中使用,也可以用于设置配置文件等。

我正在使用 RHEL7 和 RHEL8。

linux service environment-variables systemd
  • 1 个回答
  • 460 Views
Martin Hope
yeralin
Asked: 2022-03-12 07:23:06 +0800 CST

Windows 11:OpenVPN 服务在启动时无法统计

  • 0

我在我的 Windows 11 机器的目录中安装了一个 OpenVPN 配置文件config-auto,以便它在启动时连接到我的 OpenVPN 服务器。

问题是有时在系统启动时,它开始无法连接:

2022-03-11 09:27:38 [server] Inactivity timeout (--ping-restart), restarting
2022-03-11 09:27:38 SIGUSR1[soft,ping-restart] received, process restarting
2022-03-11 09:27:38 Restart pause, 5 second(s)
2022-03-11 09:27:43 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 09:27:43 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 09:27:43 TCP/UDP: Preserving recently used remote address: [AF_INET]<REDACTED>:1194
2022-03-11 09:27:43 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-03-11 09:27:43 UDP link local: (not bound)
2022-03-11 09:27:43 UDP link remote: [AF_INET]<REDACTED>:1194
2022-03-11 09:28:43 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
2022-03-11 09:28:43 TLS Error: TLS handshake failed
2022-03-11 09:28:43 SIGUSR1[soft,tls-error] received, process restarting

好像没有互联网连接,但是您可以看到我的以太网接口已启动并连接到互联网:

一旦我重新启动 OpenVPN 服务: 在此处输入图像描述

一切都开始正常工作:

2022-03-11 09:28:43 TLS Error: TLS handshake failed
2022-03-11 09:28:43 SIGUSR1[soft,tls-error] received, process restarting

2022-03-11 10:16:36 NOTE: --user option is not implemented on Windows
2022-03-11 10:16:36 NOTE: --group option is not implemented on Windows
2022-03-11 10:16:36 WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.
2022-03-11 10:16:36 DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-128-CBC' to --data-ciphers or change --cipher 'AES-128-CBC' to --data-ciphers-fallback 'AES-128-CBC' to silence this warning.
2022-03-11 10:16:36 OpenVPN 2.5.5 Windows-MSVC [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Dec 15 2021
2022-03-11 10:16:36 Windows version 10.0 (Windows 10 or greater) 64bit
2022-03-11 10:16:36 library versions: OpenSSL 1.1.1l  24 Aug 2021, LZO 2.10
2022-03-11 10:16:36 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 10:16:36 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 10:16:36 TCP/UDP: Preserving recently used remote address: [AF_INET]<REDACTED>:1194
2022-03-11 10:16:36 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-03-11 10:16:36 UDP link local: (not bound)
2022-03-11 10:16:36 UDP link remote: [AF_INET]<REDACTED>:1194
2022-03-11 10:16:36 TLS: Initial packet from [AF_INET]<REDACTED>:1194, sid=7818afbf 7c74fa3b
2022-03-11 10:16:36 VERIFY OK: depth=1, <REDACTED>
2022-03-11 10:16:36 VERIFY KU OK
2022-03-11 10:16:36 Validating certificate extended key usage
2022-03-11 10:16:36 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication

我想,这是我的 OpenVPN 和以太网接口之间的某种竞争条件。我尝试InterfaceMetric为我的以太网接口减少并为 OpenVPN 接口增加它无济于事:

Get-NetIPInterface

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore
------- --------------                  ------------- ------------ --------------- ----     --------------- -----------
29      vEthernet (WSL)                 IPv6                  1500              15 Enabled  Connected       ActiveStore
12      Ethernet 3                      IPv6                  1500               5 Disabled Disconnected    ActiveStore
10      Local Area Connection* 2        IPv6                  1500              25 Disabled Disconnected    ActiveStore
24      Ethernet                        IPv6                  1500               6 Enabled  Connected       ActiveStore
22      Local Area Connection* 1        IPv6                  1500              25 Disabled Disconnected    ActiveStore
23      OpenVPN                         IPv6                  1500              25 Enabled  Connected       ActiveStore
8       Ethernet 2                      IPv6                  1500               5 Disabled Disconnected    ActiveStore
13      OpenVPN Wintun                  IPv6                 65535               5 Disabled Disconnected    ActiveStore
1       Loopback Pseudo-Interface 1     IPv6            4294967295              75 Disabled Connected       ActiveStore
29      vEthernet (WSL)                 IPv4                  1500              15 Disabled Connected       ActiveStore
12      Ethernet 3                      IPv4                  1500               5 Enabled  Disconnected    ActiveStore
10      Local Area Connection* 2        IPv4                  1500              25 Enabled  Disconnected    ActiveStore
24      Ethernet                        IPv4                  1500               1 Enabled  Connected       ActiveStore
22      Local Area Connection* 1        IPv4                  1500              25 Enabled  Disconnected    ActiveStore
23      OpenVPN                         IPv4                  1500             100 Enabled  Connected       ActiveStore
8       Ethernet 2                      IPv4                  1500               5 Enabled  Disconnected    ActiveStore
13      OpenVPN Wintun                  IPv4                 65535               5 Disabled Disconnected    ActiveStore
1       Loopback Pseudo-Interface 1     IPv4            4294967295              75 Disabled Connected       ActiveStore

我还尝试在 OpenVPN 服务上设置恢复策略,但似乎 Windows 不会将无法连接的 OpenVPN 服务视为损坏,因此不会重新启动它: 在此处输入图像描述

同样,它只发生五分之一的靴子,大部分时间它工作正常。

搜索了整个互联网,但找不到其他人有这个问题。

windows service openvpn
  • 3 个回答
  • 431 Views
Martin Hope
KIVOX
Asked: 2022-02-13 15:24:27 +0800 CST

更新二进制文件的最佳方法?

  • 0

所以我正在制作一个可以编译为二进制文件的负载均衡器。这将在多个服务器上进行扩展。

要更新,程序本身将每 5 分钟检查一次 GitHub 存储库是否有新版本,如果有新版本,它会下载并覆盖旧版本,然后运行命令systemctl restart lb。

现在我的问题是,这是一种不好的做法吗?这样做有什么缺点吗?除此之外还有更好的更新做法吗?

--

顺便说一句,运行 cronjob 并不理想。

linux service binary go
  • 1 个回答
  • 216 Views
Martin Hope
DevOpsSauce
Asked: 2021-12-15 12:09:12 +0800 CST

使用参数启用 systemd 服务

  • 1

我有一个systemd带有参数的服务。它工作得很好。但是,我无法在没有参数的情况下启动它。

该参数看起来像systemctl start my-service@1-0.service,其中1-0将由 php 脚本解析。php 脚本的默认值为1-0,但我无法以systemctl start my-service@.service. 它告诉我:

Failed to start my-service@.service: Unit name my-service@.service is missing the instance name.

我用 成功启用了它systemctl enable my-service@.service,但它会在启动时失败吗?如果是这样,我怎么能告诉它以默认值开始,1-0如果没有指定其他内容?

service systemd
  • 1 个回答
  • 385 Views
Martin Hope
Laurent Gabiot
Asked: 2021-11-16 03:28:46 +0800 CST

在已经运行的服务(或我没有事先检查其状态的服务)上运行 `net start "<service name>"` 是不好的做法吗?

  • 1

免责声明我不熟悉这些主题(服务、net命令和服务器维护)。

在 Windows 上,该net命令允许通过net stop "<service name>"和net start "<service name>"

net start "<service name>"在未事先检查状态的服务上运行是不好的做法吗?

我知道我可以检查服务状态,只有在状态为stopped. 但是,如果这不是必需的,为什么要把事情复杂化呢?

我确实尝试在已经运行的服务上运行该命令,Powershell 只是做出了回应Le service demandé a déjà été démarré.,这可能意味着The requested service has already been started.我没有看到任何不良的副作用,但我可能会忽略很多问题。

用例是确保特定服务确实在运行。

这个特定的服务应该自动启动。托管它的服务器配置为每天在特定时间重新启动(我无法控制),并且在某些情况下,服务不会自动启动。因此,当我们正在调查启动问题时,我想通过在重新启动后的某个时间自动(通过任务计划程序)启动服务(如果它尚未运行)来临时解决此问题。

windows service powershell
  • 3 个回答
  • 243 Views
Martin Hope
Spencer
Asked: 2021-10-22 00:42:05 +0800 CST

NTP 池服务器是否使用 gpsd?

  • 0

一些 NTP 服务器所依赖的 gpsd 中的一个错误已经知道了几个月,但直到最近才真正成为常识 ,就在 2021 年 10 月 24 日翻转之前,可能会将一些 NTP 服务器的时钟设置回2002. GPSD 的补丁修复了这个错误。

由于我的公司与外界没有很高的时间同步需求,我们使用 NTP 池服务器作为我们准确时间的最终来源。(网络中的所有内容都与网络中的单个设备同步,该设备与池服务器同步。)

NTP 池网站在 2019 年之后没有任何消息,但有趣的是, 其中一项是关于2019 年发生的另一次 GPSD 周翻转。

各个机构都是自愿加入 NTP 服务器池的,因此它们各自都有自己的方法来获取准确的时间。

是否知道这些服务器是否使用 gpsd?

这个其他服务器故障问题没有解决这个问题,但它确实举例说明了为什么问题可能如此复杂。

service ntp gps
  • 1 个回答
  • 195 Views
Martin Hope
John Smith
Asked: 2021-09-18 04:30:24 +0800 CST

内核模块加载后如何运行服务

  • 0

在过去的几个小时里,我一直在为此头疼。在我的一台机器上,intel-rapl-msr驱动程序有问题,重新加载它可以解决问题。我以为我可以轻松地创建一个在启动时执行此操作的服务。但是驱动程序加载后我无法加载服务。

[Unit]
Description=Reload intel-rapl-msr
Requires=systemd-modules-load.target
WantedBy=multi-user.target

ExecStart=/nix/store/wqjkhyyffqdbx767vlqklzi12ln8j3pv-unit-script-cpu-script-start/bin/cpu-script-start

其中的脚本ExecStart仅包含:

rmmod intel_rapl_msr
modprobe intel_rapl_msr

这样,服务在启动时会失败并显示以下消息:

mmod: ERROR: Module intel_rapl_msr is not currently loaded

那么是否可以在加载此内核模块后强制服务运行?

任何帮助表示赞赏!

service drivers systemd
  • 2 个回答
  • 615 Views

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve