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

Dawson Smith's questions

Martin Hope
Dawson Smith
Asked: 2022-01-11 01:47:19 +0800 CST

语句的含义-test -x /usr/bin/find || 出口 0

  • 4

我只是想了解以下陈述的含义以及它们是否正确。

test -x /usr/bin/find || exit 0 
Command 1
Command 2
Command 3

的输出test -x /usr/bin/find始终为 0。这意味着将执行 exit 0 命令,这意味着永远不会执行命令 1、2、3。我在这里吗?

shell test
  • 2 个回答
  • 555 Views
Martin Hope
Dawson Smith
Asked: 2022-01-09 00:23:22 +0800 CST

删除所有超过 7 天的文件的 Cron 作业:-exec rm -f {} \; vs -delete [重复]

  • 1
这个问题在这里已经有了答案:
为什么 find with -delete 删除了我的 /save/ 目录中的文件,而 find without delete 却无法找到它们? (1 个回答)
9 个月前关闭。

我想运行一个删除.txt超过 7 天的文件的 cron 作业。我有两个命令。第一个命令:

/usr/bin/find /var/www/example.com/wp-content/targetdir -name "*.txt" -type f -mtime +7 -exec rm -f {} \;

第二条命令:

/usr/bin/find /var/www/example.com/wp-content/targetdir -name "*.txt" -type f -mtime +7 -delete

这两个命令都可以用来删除.txt超过 7 天的文件。我读过第一个命令与race condition. 能否详细说明使用第二个命令相对于第一个命令的优势?使用其中一个的优点和缺点是什么?

cron rm
  • 1 个回答
  • 2563 Views
Martin Hope
Dawson Smith
Asked: 2022-01-08 03:03:17 +0800 CST

Logrotate 场景 - 混合和匹配 cron.daily 和 daily 指令

  • 0

文件:

/etc/cron.daily/logrotate

有以下声明:

/usr/sbin/logrotate /etc/logrotate.conf

该logrotate.conf文件具有weekly内部定义的指令。

现在我有两个旋转配置文件abc和def里面/etc/logrotate.d的 . abc里面有指令daily,据我所知,它将覆盖. 并且没有这样的指令,因此它将从. 现在我怀疑它会每天运行,并将检查文件内部,而该 文件又包含指令。因此,总而言之,将通过和。我的问题是 和 的实际对数旋转频率是多少?他们是每天轮换还是每天轮换一次,每周轮换一次?weekly/etc/logrotate.confdefweekly/etc/logrotate.conf/etc/cron.daily/logrotate/etc/logrotate.confinclude /etc/logrotate.d/etc/cron.daily/logrotateabcdefabcdef

cron logrotate
  • 1 个回答
  • 203 Views
Martin Hope
Dawson Smith
Asked: 2022-01-07 10:15:25 +0800 CST

以人类可读的格式打印 cron 时间

  • 1

在对cron.daily(weekly和“每小时”)运行的时间进行了足够的研究之后,我发现了以下命令 -

grep run-parts /etc/crontab

但是这个命令的输出不是很直观。如果我想以人类可读的格式查看玉米运行时间,例如date命令给出的格式,我应该怎么做?

cron
  • 1 个回答
  • 134 Views
Martin Hope
Dawson Smith
Asked: 2022-01-06 23:37:16 +0800 CST

以下命令的解释一个接一个地执行

  • 0

我有这两个命令一个接一个地执行。

cat a.log >> b.log
rm -r a.log

这里到底发生了什么?为什么猫在这里被使用?>> 符号呢?使用的 -r(recursive) 标志是什么?

command
  • 1 个回答
  • 27 Views
Martin Hope
Dawson Smith
Asked: 2022-01-06 23:23:03 +0800 CST

如果在 logrotate 的情况下定义了 size 参数,ifempty 和 notifempty 如何工作?

  • 1

假设我有这样的 logrotate 命令

/a/b/file.log{
size 5M 
ifempty
}

现在 logrotate 在大小应大于 5MB 的条件下工作,然后 logrotate 将开始为该文件工作。但是在这种情况下 ifempty 将如何工作?在这种情况下,优先级是什么?那notifempty的情况呢?

linux logrotate
  • 1 个回答
  • 334 Views
Martin Hope
Dawson Smith
Asked: 2022-01-06 04:25:58 +0800 CST

错误:错误设置 uid 0 和 gid 0 的所有者:不允许操作

  • 0

运行命令时/usr/sbin/logrotate /etc/logrotate.d/applogrotate。我得到错误error: error setting owner of a.s to uid 0 and gid 0: Operation not permitted。在 applogratate 文件中,我写create 0664 root root了我认为是错误原因的内容。有人可以帮忙解决吗?

logrotate
  • 1 个回答
  • 490 Views
Martin Hope
Dawson Smith
Asked: 2022-01-06 00:46:05 +0800 CST

了解 logrotate 中单独旋转和使用压缩旋转之间的区别

  • 0

下面的块没有压缩语句 -

/a/b/file.log{
size 200M
create 0664 root root
rotate 10
datext
dateformat -%Y-%m-%d-%s
}

这个有一个压缩声明 -

/a/b/file.log{
size 200M
create 0664 root root
rotate 10
compress
datext
dateformat -%Y-%m-%d-%s
}

这个有一个 nocompress 声明 -

/a/b/file.log{
size 200M
create 0664 root root
rotate 10
nocompress
datext
dateformat -%Y-%m-%d-%s
}

以上三种情况有什么区别?每个人的 logrotate 功能有何不同?

logrotate
  • 2 个回答
  • 118 Views
Martin Hope
Dawson Smith
Asked: 2022-01-05 23:50:58 +0800 CST

Logrotate 命令方块说明

  • 0

我有以下 logrotate 命令块 -

/a/b/file.log{
size 200M
create 0664 root root
rotate 10
compress
datext
dateformat -%Y-%m-%d-%s
}

有人可以详细说明上述块的含义吗?

尤其是陈述——

  • 创建 0664 root root
  • 数据文本
  • 日期格式 -%Y-%m-%d-%s

还有任何用于 logrotate 命令块的好资源

linux logrotate
  • 1 个回答
  • 18 Views
Martin Hope
Dawson Smith
Asked: 2022-01-05 10:45:15 +0800 CST

文件 cat /etc/logrotate.conf 和 cat /etc/logrotate.d 和 cat /etc/cron.daily/logrotate 之间的区别

  • 0

我是 logrotate 的新手。我看到三个文件/etc/logrotate.conf,它们对 logrotate 功能至关重要/etc/logrotate.d。/etc/cron.daily/logrotate但我无法理解他们个人的工作和意义。有人可以向我解释这两个文件的意义是什么吗?还有哪些对 logrotate 很重要的其他文件以及它们在哪里?

logrotate
  • 1 个回答
  • 116 Views
Martin Hope
Dawson Smith
Asked: 2022-01-05 02:23:52 +0800 CST

语句的含义 -du -sk * |sort -rn|head

  • 1

我在理解这个 Linux 命令的含义时遇到了麻烦:

du -sk * | sort -rn | head

我知道 du 用于显示磁盘使用情况,但我在理解命令的其余部分时遇到了麻烦。有人可以分解这里到底发生了什么吗?还可以建议一些好的资源来详细研究复杂的linux命令吗?

disk-usage
  • 2 个回答
  • 78 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