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-581126

DenisZ's questions

Martin Hope
DenisZ
Asked: 2021-05-31 05:08:57 +0800 CST

如何在 systemd 中创建自定义服务?

  • 0

在多台机器上运行 Fedora 33/34。我成功激活rc-local.service了它工作正常。我有几个需要运行的其他脚本,/etc/init.d/并且我创建了与 类似的服务文件rc-local.service,但我无法启用它,而 rc-local.service 可以毫无问题地启用/禁用/盯着/停止。
我知道,我有一个选项(我目前使用)从rc.local文件中调用这些脚本,但宁愿将它们作为服务单独调用。所以我的服务文件如下所示:
#cat net-scr1.service

[Unit]
Description=Network check service
ConditionFileIsExecutable=/etc/init.d/net-scr1
After=network.target 

[Service]
Type=forking
ExecStart=/etc/init.d/net-scr1 start
TimeoutSec=3
ExecStop=/etc/init.d/net-scr1 stop
RemainAfterExit=yes
GuessMainPID=no
StandardOutput=tty

[Install]
 WantedBy=multi-user.target

systemctl enable net-scr1

Synchronizing state of net-scr1.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable net-scr1
service net-scr1 does not support chkconfig

我将脚本移出init.d考虑可能 systemd 假设它是一个旧sysv脚本,但没有改变。我的脚本中应该有什么才能正常工作?
我的脚本看起来像:

#!/bin/bash
[email protected]
[email protected]
dv0=p1p1
ipdv0=`ifconfig $dv0 | grep "inet " | awk '{print $2}'`
if [ "$1" = "stop" ]; then
  cat $msg | mail $EMFR -s "$srv-shut_down-ip-$ipdv0" $eml
fi
if [ "$1" = "start" ]; then
  cat $msg | mail $EMFR -s "$srv-booted_up-ip-$ipdv0" $eml  

fi

我应该包含旧 sysv 系统中的函数还是其他什么?谢谢

scripting bash systemd systemd-service
  • 2 个回答
  • 264 Views
Martin Hope
DenisZ
Asked: 2021-05-25 22:32:27 +0800 CST

如何克隆带有坏扇区的 PMBR 磁盘?

  • 0

我正在尝试使用 PMBR 分区和坏扇区克隆 1TB 磁盘。它上面有工作的 Windows 分区,并且可以通过 MBR 启动。
blkid不识别分区

/dev/sdc: PTTYPE="PMBR"

gdisk /dev/sdc

    GPT fdisk (gdisk) version 1.0.7

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Caution! After loading partitions, the CRC doesn't check out!
Warning: Invalid CRC on main header data; loaded backup partition table.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.

Warning! One or more CRCs don't match. You should repair the disk!
Main header: ERROR
Backup header: OK
Main partition table: ERROR
Backup partition table: ERROR

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: damaged

Found valid MBR and corrupt GPT. Which do you want to use? (Using the
GPT MAY permit recovery of GPT data.)
 1 - MBR
 2 - GPT
 3 - Create blank GPT

Your answer: 

我尝试gdisk使用 ( 2) ( r) ( b) ( w) 但结果不想写

 Warning! Main partition table overlaps the first partition by 34 blocks!
You will need to delete this partition or resize it in another utility.

Warning! Secondary partition table overlaps the last partition by
17599083851618035976 blocks!
You will need to delete this partition or resize it in another utility.

Problem: partitions 121 and 119 overlap:
  Partition 121: 925735787758310161 to 13474437941687892909
  Partition 119: 11147454187938441805 to 15638604846186930334

Problem: partitions 121 and 120 overlap:
  Partition 121: 925735787758310161 to 13474437941687892909
  Partition 120: 3391649715396322562 to 7297187905800799496

Problem: partitions 122 and 120 overlap:
  Partition 122: 3391649715396322562 to 7297187905800799496
  Partition 120: 3391649715396322562 to 7297187905800799496

Problem: partitions 122 and 121 overlap:
  Partition 122: 3391649715396322562 to 7297187905800799496
  Partition 121: 925735787758310161 to 13474437941687892909

Problem: partitions 123 and 119 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 119: 11147454187938441805 to 15638604846186930334

Problem: partitions 123 and 120 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 120: 3391649715396322562 to 7297187905800799496

Problem: partitions 123 and 121 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 121: 925735787758310161 to 13474437941687892909

Problem: partitions 123 and 122 overlap:
  Partition 123: 925735787758310161 to 13474437941687892909
  Partition 122: 3391649715396322562 to 7297187905800799496

Problem: partitions 124 and 119 overlap:
  Partition 124: 10336404087008029236 to 15113227714779688721
  Partition 119: 11147454187938441805 to 15638604846186930334

Problem: partitions 124 and 121 overlap:
  Partition 124: 10336404087008029236 to 15113227714779688721
  Partition 121: 925735787758310161 to 13474437941687892909

Problem: partitions 124 and 123 overlap:
  Partition 124: 10336404087008029236 to 15113227714779688721
  Partition 123: 925735787758310161 to 13474437941687892909
Aborting write operation!
Aborting write of new partition table.

clonezilla 无法识别我尝试过 gparted 的分区,Rescue system partitions 但它整晚都在扫描,什么也没有。
使用: cfdisk /dev/sdc 工作正常

                                                                              Disk: /dev/sdc
                                                        Size: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
                                                                    Label: dos, identifier: 0x9f9fd106

    Device                 Boot                              Start                   End               Sectors              Size            Id Type
>>  /dev/sdc1                                                    1                206846                206846              101M            ee GPT                        
    /dev/sdc2              *                                206848             617201663             616994816            294.2G             7 HPFS/NTFS/exFAT
    /dev/sdc3                                            617201664            1916342271            1299140608            619.5G             7 HPFS/NTFS/exFAT
    /dev/sdc4                                           1916342272            1953316862              36974591             17.6G            c0 unknown
    Free space                                          1953316864            1953525167                208304            101.7M     

                                 

如何在 fedora 或 PartedMagic live 下挂载分区?谢谢

mbr clonezilla rescue-disk
  • 2 个回答
  • 395 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