如何在不改变 /etc/crontab 文件原内容的前提下,将新条目插入到其中?最好使用一行命令实现。
这是我想要插入到 /etc/crontab 中的示例条目,如果已经存在,请不要重复插入。
*/1 * * * * some_user python /mount/share/script.py
我正在使用CentOS 6.6,目前我有以下内容:
if grep "*/1 * * * * some_user python /mount/share/script.py" /etc/crontab; then echo "Entry already in crontab"; else echo "*/1 * * * * some_user python /mount/share/script.py" >> /etc/crontab; fi
tee
探索选项。 - Bix-bash: */1 * * * * some_user python /mount/share/script.py: No such file or directory
。 - Athena Wisdom