1

I recently installed opencv but before I run the python script i always have to run these two commands:

workon cv
source ~/.profile

I already tried running the commands at boot, here's my '/etc/rc.local':

#!/bin/sh -e

IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/home/pi/boot.sh
# boot.sh contains those two commands
exit 0

but it didn't work.

I even tried using crontab -e, but that too didn't work

Is there any other way by which i can avoid typing those commands in future?

1
  • I'm not sure if that is in any way specific to the Raspberry Pi. You might have more luck Stack Overflow or Unix & Linux. Commented Sep 5, 2016 at 18:03

1 Answer 1

2

Have you made sure you're file is executable?

Try changing /home/pi/boot.sh to say this:

#!/bin/bash
workon cv
source /home/pi/profile

Then make the file executable with the following command:

chmod +x /home/pi/boot.sh

Also, rc.local is run as root so ~/profile would mean /root/profile instead of /home/pi/profile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.