Hi,
I have been surfing for almost two days to look for related problem and solutions. But to no avail, I have not found any suitable ones. Any help is greatly appreciated!!
I am using Raspian on Rpi. I am running a python script
pi_surveillance.py that requires an activation of the virtual environment
cv before the script can work. I am implementing it on cronjob as I wanted it to run at every reboot.
The virtual environment is created for pi user. Hence, what I did was to create a
launcher.sh script to activate the environment and run the python script.
Code:
#!/bin/bash
# launcher.sh
# activate the cv environment ,then execute
# python script
source ~/.profile
workon cv
python /home/pi/pi_surveillance.py --conf conf.json
For cronjob, what I did was,
At the last line of the crontab, I added a line:
Code:
@reboot sudo -u pi /home/pi/launcher.sh >/home/pi/logs/cronlog 2>&1
But, it did not work out and reflected this on my cron log.
Code:
Traceback (most recent call last):
File "/home/pi/pi_surveillance.py", line 28, in <module>
conf = json.load(open(args["conf"]))
IOError: [Errno 13] Permission denied: 'conf.json'
I am really desperate for a solution or a direction to where I should work towards!!