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 / 问题 / 1129735
Accepted
Souad
Souad
Asked: 2023-04-26 22:15:38 +0800 CST2023-04-26 22:15:38 +0800 CST 2023-04-26 22:15:38 +0800 CST

设备关闭。找不到服务

  • 772

我正在尝试在 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 1 个回答
  • 23 Views

1 个回答

  • Voted
  1. Best Answer
    Souad
    2023-04-27T20:44:35+08:002023-04-27T20:44:35+08:00

    此问题的答案是通过执行以下操作(永久禁用)来禁用 SELinux 功能:

    vi /etc/sysconfig/selinux
    

    然后将指令更改SELinux=enforcing为SELinux=disabled

    然后重新启动 : sestatus,它现在应该显示它已被禁用。

    • 0

相关问题

  • 计划终止端口连接

  • 如何提供可搜索的 IRC 日志?

  • GlassFish 服务在控制台注销时停止

  • “工作站”和“服务器”服务不断停止

  • 如何删除或卸载孤立服务?

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