我如何在raspbian上以用户身份执行crontab? [英] how i can do a crontab as user on raspbian?
问题描述
我正在与rasbpian一起在树莓派上玩!
我正在尝试安装新的crontab来执行基本脚本。这个会用vlc从网络摄像头拍张照片。
I'm on a raspberry pi, with rasbpian ! I'm trying to install a new crontab for execute an basic script. This one will take a picture from webcam with vlc.
我想每分钟执行一次,但是我不能编辑我的crontab用户(crontab -e),只有sudo crontab ...或vlc必须在没有root的情况下执行!
I want to do this every minute but i can't edit my crontab user (crontab -e), only the sudo crontab... Or vlc must do execute without root !
pi@raspberrypi ~ $ crontab -e
crontabs/pi/: fdopen: Permission denied
每个人都知道我该怎么做?
Every body know how i can do ?
这是我的脚本:
#!/bin/bash
cvlc -I dummy v4l2:///dev/video0 --video-filter scene --no-audio --scene-path $
date > ~/webcam/date.txt
这是我的root的crontab,不起作用:
And this is my crontab for root, which not work :
* * * * * sh image.sh
推荐答案
我不知道为什么您为什么拒绝 crontab -e
的权限,但是如果您使用 sudo crontab -e -u pi
,则可以使用sudo为pi用户打开crontab。
I don't know why you're getting permission denied for crontab -e
, but if you use sudo crontab -e -u pi
, then you will be able to open the crontab for the pi user with sudo.
偶然地,您可能需要为 image.sh
指定直接路径。否则脚本将无法找到它。
Incidentally, you probably need to specify a direct path for image.sh
. Otherwise the script won't be able to find it.
这篇关于我如何在raspbian上以用户身份执行crontab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!