hi,
im in the making of a school project which uses opencv to react to people
i have my code working however it requires being ran from a venv, and i am struggling to have have it enter the venv and run the code from boot.
any help would be much appreciated (and quickly too im on a VERY tight deadline)
Can't help with deadlines, that's on you. I'm also not going to debug your school project for you.
ive tried using a sh file that is ran through crontabCode:
#!/bin/bash# source startup.shcd /homecd /home/din/yolo &&source /home/din/yolo/venv/bin/activate &&python /home/din/yolo/ds.py
You don't need the first cd command and I'd remove the line breaks after each &&
and trying to run it directly through crontab by usingCode:
/home/din/yolo/venv/bin/python
That'll run the interpreter which will immediately exit or, possibly, sit there doing nothing as it tries to get interactive input from /dev/null.
i am very much a newbie and thought it would be smooth sailing after i got the main code working but here we are =(
There are significant differences between running under cron and running under a logged in terminal. The first of which is that cron will discard all output and error messages generated by your code unless explicitly told not to.*
See sections 4.3, 8, and 9 of my guide that neilgl linked you to.
[shameless self promotion]
For more details on using cron see Cron – A Beginner's Guide
[/shameless self promotion]
TL;DR: find the error(s) being thrown under cron. Without them there is nothing useful you or anyone else can do.
*: because cron defaults to emailing them to a local user but there is no preinstalled MTA**
**: Mail Transfer Agent
Statistics: Posted by thagrol — Mon May 19, 2025 4:48 pm