我被困在从根目录下的 ubuntu 服务器中设置 cron。
当我尝试使用: -
sudo crontab -e 它给了我错误“root 没有 crontab - 使用一个空的
888"
请帮帮我。我需要每分钟设置一次 cron。
最佳答案
假设您在/home/username/hello.sh 中有一个 hello.sh,代码如下
#!/bin/bash
echo "Hello World!!!"
创建一个文件/etc/cron.d/hellocron 并将下面的行放入其中
* * * * * root /home/username/hello.sh
cron 将每分钟运行/home/username/hello.sh,在本例中,它将打印字符串“Hello World!!!”每一分钟。
关于unix - 如何在 ubuntu 中从 root 设置 cron?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19203255/