这是我第一次通过 /etc/cron.hourly 目录使用 cron 每小时运行一次脚本。
出于某种原因,脚本似乎没有运行。
这是我所做的:
在 /etc/cron.hour 添加了一个基本的测试脚本:
/etc/cron.hourly# ll
-rwxr-xr-x 1 root root 152 Jun 20 23:26 test.bash*
Run Code Online (Sandbox Code Playgroud)
这是脚本:
/etc/cron.hourly# cat test.bash
#!/bin/bash
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
echo "This line from test.bash" > /tmp/from.test.script
Run Code Online (Sandbox Code Playgroud)
这是/etc/crontab:
/etc/cron.hourly# cat /etc/crontab
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
Run Code Online (Sandbox Code Playgroud)
Cron 包是默认安装的,所以接下来,我跑了/etc/init.d/cron restart
,一直等到 :17。在 /tmp 中仍然没有输出的痕迹。
知道我还能尝试什么吗?
/etc/cron.hourly# run-parts --list /etc/cron.hourly
/etc/cron.hourly# run-parts --test /etc/cron.hourly
/etc/cron.hourly#strace run-parts /etc/cron.hourly
execve("/bin/run-parts", …
Run Code Online (Sandbox Code Playgroud) 我需要一种方法来每天上午 11:45 唤醒 Debian 主机。
\n\n看起来 rtcwake 是一个很好的工具,但我无法让它使用正确的时间。
\n\n硬件时钟设置为UTC,我位于UTC+2:
\n\n# timedatectl\n Local time: Tue 2017-03-28 01:19:45 CEST\n Universal time: Mon 2017-03-27 23:19:45 UTC\n RTC time: Mon 2017-03-27 23:19:46\n Time zone: Europe/Paris (CEST, +0200)\n NTP enabled: no\nNTP synchronized: no\n RTC in local TZ: no\n DST active: yes\n Last DST change: DST began at\n Sun 2017-03-26 01:59:59 CET\n Sun 2017-03-26 03:00:00 CEST\n Next DST change: DST ends (the clock jumps one hour backwards) at\n Sun 2017-10-29 02:59:59 CEST\n Sun …
Run Code Online (Sandbox Code Playgroud) 我需要从基于 ARM 的 Debian 设备的存储库中找到所有可用的 Web 服务器。
我运行了以下命令,但它返回的点击次数过多(包括库等):
apt-get update
apt-cache search http server
Run Code Online (Sandbox Code Playgroud)
我应该使用更好的命令吗?