我已经设置anacron
运行几个任务,但由于某种奇怪的权限错误,它似乎失败了。
这是我的anacrontab
:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
@daily 1 bashrc.daily rsync -aAX $HOME/.bashrc /run/media/MYUSER/samsung/home/MYUSER/.bashrc
@daily 1 bash_aliases.daily rsync -aAX $HOME/.bash_aliases /run/media/MYUSER/samsung/home/MYUSER/.bash_aliases
@daily 5 variety.daily rsync -aAX $HOME/.config/variety/ /run/media/MYUSER/samsung/home/MYUSER/.config/variety/
@daily 3 testfile.daily rsync -aAX $HOME/Documents/flag.hs /run/media/MYUSER/samsung/flag.hs
@weekly 5 st_apps.daily rsync -aAX $HOME/.local/share/Steam/steamapps/ /run/media/MYUSER/samsung/home/MYUSER/.local/share/Steam/steamapps/
@weekly 15 st_ud.daily rsync -aAX $HOME/.local/share/Steam/userdata/ /run/media/MYUSER/samsung/home/MYUSER/.local/share/Steam/userdata/
@weekly 1 anacrontab.weekly rsync -aAX /etc/anacrontab /run/media/MYUSER/samsung/home/anacrontab
这是的输出journalctl -b --no-pager --catalog | grep anacron
jan. 14 00:02:09 MYPC anacron[73073]: Anacron started on 2022-01-14
jan. 14 00:02:09 MYPC anacron[73073]: Can't open timestamp file for job cron.daily: Permission denied
jan. 14 00:02:09 MYPC anacron[73073]: Aborted
jan. 14 00:02:42 MYPC sudo[73113]: MYUSER : TTY=pts/0 ; PWD=/home/MYUSER ; USER=root ; COMMAND=/usr/bin/dd bs=4k of=/etc/anacrontab
jan. 14 00:02:50 MYPC sudo[73124]: MYUSER : TTY=pts/0 ; PWD=/home/MYUSER ; USER=root ; COMMAND=/usr/bin/dd bs=4k of=/etc/anacrontab
有人可以在正确的方向上刺激我吗?
系统:Fedora 35
我
anacron
之前工作过,但不再工作了,所以我决定采取不同的方法。为了能够在没有升级权限的情况下运行它,您需要执行以下操作:.anacron
使用命令在您的主目录和两个子目录(etc
和spool
)中创建一个文件夹mkdir -p ~/.anacron/{etc,spool}
。etc
通过运行与touch $HOME/.anacron/etc/anacrontab
原始/etc/anacrontab
. 例如:crontab -e
并添加以下内容:您可以测试等待 cron 执行每小时任务,也可以
anacron
通过 running 强制立即运行anacron -fnd -t $HOME/.anacron/etc/anacrontab -S $HOME/.anacron/spool/
。希望这对将来的其他人有所帮助!