如果我以非 su 用户身份从终端运行以下脚本,它会运行,并且dconf-settings.ini
文件大小会更新为 17.2kB。但是,如果我在 Anacron 中运行相同的脚本,它会dconf-settings.ini
更新,但文件大小为 0:
#!/bin/bash
if ! mount | grep /media/steve/6363-6333 >/dev/null
then
dpkg --get-selections > /home/steve/package_list
/usr/bin/dconf dump / > dconf-settings.ini
else
rsync /home/steve/ownCloud/Documents/investDe7.ods /media/steve/6363-6333/investDe7.ods
dpkg --get-selections > /media/steve/6363-6333/package_list
/usr/bin/dconf dump / > /media/steve/6363-6333/dconf-settings.ini
fi
我把 Anacron 中的 $PATH 改成了我自己的路径。这是 anacrontab:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
HOME=/root
LOGNAME=root
# These replace cron's entries
1 5 cron.daily run-parts --report /etc/cron.daily
7 10 cron.weekly run-parts --report /etc/cron.weekly
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly
#Steve's additions
1 15 sync.daily /home/steve/Scripts/syncStuff
几天前我发布了类似的问题,但这不是同一个问题。