Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 cron 工作。
* * * * * root python /root/folder/script.py
/root/folder/script.py - 脚本的完整路径。
我需要脚本的相对路径之类的东西。
* * * * * root python ~/folder/script.py
Cron 必须找到“文件夹”并执行 script.py
我希望可以自由地将 /folder/script.py 放在文件系统中的任何位置。
尝试
* * * * * python $(getent passwd the-user | cut -d: -f6)/folder/script.py