0

我已经编写了一个 python 脚本,它将更改我的 Lxde crouton shell 上的桌面墙纸,它似乎运行得很好:

import os
from time import localtime
from pathlib import Path

wp = Path("/home/lucasmccallums/Desktop/projects/wallpaper_transitions")


hour = localtime().tm_hour

if (hour < 6) or (hour >= 21):
    os.system("pcmanfm --set-wallpaper=" + str(wp / "night.png"))

elif (hour >= 14):
    os.system("pcmanfm --set-wallpaper=" + str(wp / "afternoon.png"))

else:
    os.system("pcmanfm --set-wallpaper=" + str(wp / "morning.png"))

但是,当我尝试通过 crontab 运行它时, */1 * * * * /usr/bin/python3 /home/lucasmccallums/Desktop/projects/wallpaper_transitions/desktopdemo.py 它似乎安装得很好 crontab: installing new crontab 但是它似乎仍然不起作用。我尝试使用命令 /etc/init.d/cron start 但我面临
cron: can't open or create /var/run/crond.pid: Permission denied

我会不断更新,因为我试图解决这个问题,但任何帮助将不胜感激,谢谢!

4

1 回答 1

0

在 Crontab 上

0 6,14,21 * * */usr/bin/somedirectory/py.....
于 2020-06-14T12:07:50.143 回答