我编写了一个python脚本,它将更改我的Lxde油煎面包块外壳上的桌面墙纸,看起来运行得很好:
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
在我尝试解决这个问题时,我将不断更新,但是 任何帮助将不胜感激,谢谢!
答案 0 :(得分:0)
在Crontab上
0 6,14,21 * * */usr/bin/somedirectory/py.....