我想通过设置计划任务,anacron但我想在用户模式下这样做。我怎样才能做到这一点?
我一直在谷歌上徒劳地搜索 cron 和 anacron 如何协同工作的一般解释。在这一点上,手册页对我来说有点太深入了。
我很困惑,因为我向 crontab 添加了任务,这有效,但是当我从 crontab 中删除它们时,它们仍然在 anacron 下运行。我在 /etc/cron.daily 中看到了任务,但我不确定它们是如何到达那里的。cron 总是在我的系统上运行,但不是 anacron。其实我看到 anacron 是由 cron 启动的!
基本上我想要一个关于如何添加和删除任务的用户级介绍,因为告诉你编辑 crontab 的易于搜索的答案并不完整。一个教程的链接就可以了。
我已经对我的系统进行了最小安装。我想将此系统用作 PLEX 媒体服务器。我已经配置了 LXDE,因为它是一个轻量级的 GUI。我正在配置我的系统以使用 rsnapshot 进行自动备份。我已经成功配置了我的 rsnapshot.conf 文件,并且通过在终端中运行 rsnapshot 每周命令,我得到了想要的结果。
这是我的 rsnapshot.conf 文件:
#################################################
# rsnapshot.conf - rsnapshot configuration file #
#################################################
# #
# PLEASE BE AWARE OF THE FOLLOWING RULE: #
# #
# This file requires tabs between elements #
# #
#################################################
#######################
# CONFIG FILE VERSION #
#######################
config_version 1.2
###########################
# SNAPSHOT ROOT DIRECTORY #
###########################
# All snapshots will be stored under this root directory.
#
snapshot_root /media/siddharth/Backup/Backup
# If no_create_root is …Run Code Online (Sandbox Code Playgroud) 每天,我都会通过 postfix 收到以下邮件:
From: Anacron <root@name.domain>
To: root@name.domain
Subject: Anacron job 'cron.daily' on name
Content-Type: text/plain; charset=US-ASCII
Message-Id: <20130708082739.88AE83A3F72@name.domain.domain>
Date: Mon, 8 Jul 2013 10:27:39 +0200 (CEST)
/etc/cron.daily/ntpdate:
8 Jul 10:27:39 ntpdate[4617]: step time server 85.254.216.1 offset -1.454673 sec
Run Code Online (Sandbox Code Playgroud)
但是,我想限制 anacron 只在出现问题时警告我。有什么办法可以做到这一点吗?我可以更改 anacrontab 文件以将所有邮件发送到 /dev/null,但是我不会收到任何警告邮件。
有没有更好的方法来控制 anacron 状态更新的粒度?
我是否正确理解不可能/etc/cron.daily/my从任意用户运行,它只能从root根据运行/etc/crontab?
我可以在我的 cron 脚本中删除特定用户的 root 权限吗?
最好将 cron 作业放入/etc/cron.d? 喜欢:
$ cat /etc/cron.d/my
5 0 * * * user test -x /usr/bin/my && /usr/bin/my -cfg /etc/my.cfg
Run Code Online (Sandbox Code Playgroud) $ ps -elf | grep
...
0 D nobody 27320 27319 2 90 10 - 353471 sleep_ 07:54 ? 00:02:19 /usr/bin/find / -ignore_readdir_race ( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite …Run Code Online (Sandbox Code Playgroud) 我想在 Ubuntu 13.04 上每周使用 anacron。
这是我的 /etc/crontab:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * …Run Code Online (Sandbox Code Playgroud) 我试图每天运行一次命令,但我的机器并不总是打开。anacron说它是为了这些目的,但我更喜欢使用 Gnome Scheduled Tasks GUI 程序。
如果我通过计划任务( gnome-schedule)使用“新”循环任务安排每天运行的任务,该任务是通过cron还是发出anacron?
也就是说,如果计算机关闭几天然后我重新启动它,日常任务是否会在它开始的那一天只运行一次,然后每天运行一次(即像 anacron?)。
我不清楚Gnome 计划任务如何使用cron以及如何anacron使用。我真的需要关心使用的是哪个,只要我通过这个 GUI 吗?
Linux 提供了三种不同的作业调度程序,即 Cron、Anacron 和 Systemd-Timer。Cron/Anacron 与 Systemd-Timer 相比有什么好处?
我一直试图从这个视频中找出如何使用 crontab 添加作业:
https://www.youtube.com/watch?v=vrPGRE6FV9g
足够简单易懂,但我在等中找不到 crontab?实际上,一些视频似乎也提到了 crontab。似乎所有视频都很旧,不适用于 Ubuntu 16.04。
那么它在哪里,如果有的话?如果没有,有人有我可以遵循的 16.04 教程吗?
谢谢!
编辑:对不起,伙计们,我找到了。我在 etc/ 中寻找物理文件夹,但它不是文件夹!!!谢谢大家。