Close

Trouble getting commands to run

Having trouble with Sighthound Video? Post here for help.

Moderator: Staff

no avatar
afeltham
 
Posts: 2
Joined: Sun Nov 27, 2011 8:11 am

Trouble getting commands to run

by afeltham » Sun Nov 27, 2011 8:19 am

Hello,

I've recently upgraded to the basic license so that i can use the ability to run commands to try and aggregate multiple events into one - ie, if an event is triggered twice in a 5 minute period, treat that as one event and send one email.

I've been able to write the code to do this successfully but am having some problems getting Vitamin D to actually execute the script. I've tested exactly what i've entered into the application via a terminal and it works, yet when its saved in the application nothing happens. I have tried running via a shell script or direct and neither work. In fact, the application doesn't think the path i've given it is valid when it really is!

The most frustrating thing is that i'd love to help myself by looking at the logs but i can't find anywhere that menions where those logs are!? I'm on OSX Lion and would love someone to help point me in the right direction ( and perhaps updating http://www.vitamindinc.com/support/ref_guide_rules.html with the path? )

Thanks in advance, Andy.

no avatar
doug
 
Posts: 63
Joined: Sun Sep 12, 2010 10:24 pm

Re: Trouble getting commands to run

by doug » Sat Dec 03, 2011 12:50 am

Andy,

You can find where your logs are stored by looking up a few directories from where the video is stored. That's in the reference guide here: <http://www.vitamindinc.com/support/ref_guide_tips_16.html>. As an example, on the Mac the video is stored at "/Users/<your user name>/Library/Application Support/Vitamin D Video/videos/archive/<your camera name>" and you can find the logs in "/Users/<your user name>/Library/Application Support/Vitamin D Video/logs".

As far as running a shell script, it should be pretty simple on Mac. What's in your script and what are you entering as the command? I just tried it like this:

I entered this into Vitamin D Video as this command:
/Users/dianders/bin/test.sh a b c

...where "dianders" is my username on my Mac.

Then, I have test.sh in my "bin" directory. It looks like:
Code: Select all
#!/bin/sh
touch /tmp/foo.bar
echo "Hi" "$@" >> /tmp/foo.bar


...when I hit the "Test" button in Vitamin D Video, I see "Hi a b c" appended to /tmp/foo.bar

Note: don't forget to "chmod +x /Users/dianders/bin/test.sh" so that the script is actually executable.


HTH!

-Doug

no avatar
afeltham
 
Posts: 2
Joined: Sun Nov 27, 2011 8:11 am

Re: Trouble getting commands to run

by afeltham » Sat Dec 03, 2011 8:03 am

Okay, thanks for that. I think i have sorted out my problem now. A couple of notes though...

- the addition of the #!/bin/sh seemed to make a difference, and yet didn't to the script running.
- the command i wanted to run was "/opt/local/bin/php -f < my php file>" and with that line simply in a .sh file it works okay, but apparently not with Vitamin D. I guess the more confusing thing was why i had to wrap that command in a shell script file in the first place in order to get it to run?

In any case, i think i'm sorted now so thank you for the help.

Andy.

no avatar
doug
 
Posts: 63
Joined: Sun Sep 12, 2010 10:24 pm

Re: Trouble getting commands to run

by doug » Sun Dec 04, 2011 12:29 pm

I'm not too surprised by the need to wrap in a shell script, though I'd need to debug the exact scenario. Specifically, it's very possible that some environment variables needed to run your php are setup in your .bashrc or something similar. If you don't run through the shell, those variables will never be set. ...or, it may be something else...

I'm glad things are working for you now!

-Doug


Return to Technical Support