Running shell script in Hazel

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Re: Running shell script in Hazel Wed Dec 05, 2012 11:53 am • by a_freyer
jarhead wrote:
In Terminal, once I cd into /users/doug/octopress, the following two scripts run correctly...

Code: Select all
/usr/bin/rake -f /Users/doug/octopress/rakefile generate


Code: Select all
/Users/doug/.rvm/gems/ruby-1.9.3-p327@global/bin/rake generate




Hmmm... you shouldn't have to change directories for either of these. Are you seeing anything in the system log?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Running shell script in Hazel Wed Dec 05, 2012 4:16 pm • by Mr_Noodle
Those programs may operate using the current directory so you may have to 'cd' in this case. Does everything work if you do the 'cd'?
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Running shell script in Hazel Mon Dec 10, 2012 2:21 pm • by jarhead
a_freyer wrote:Hmmm... you shouldn't have to change directories for either of these. Are you seeing anything in the system log?


Nothing in the system log.
jarhead
 
Posts: 12
Joined: Mon Dec 03, 2012 2:55 pm

Re: Running shell script in Hazel Mon Dec 10, 2012 2:22 pm • by jarhead
Mr_Noodle wrote:Those programs may operate using the current directory so you may have to 'cd' in this case. Does everything work if you do the 'cd'?


Both of the commands run correctly after doing cd /users/doug/octopress in Terminal...
jarhead
 
Posts: 12
Joined: Mon Dec 03, 2012 2:55 pm

Re: Running shell script in Hazel Mon Dec 10, 2012 3:33 pm • by Mr_Noodle
One thing you can try is to do ". ~/.bashrc" (substitute whichever bash/sh config file contains all your environment variable definitions) at the beginning of your script. I wouldn't recommend this in general but it may help narrow down the problem. I'm guessing there's some env var that needs to be set for things to work properly.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Running shell script in Hazel Sun Feb 03, 2013 4:54 am • by nleco
hi all. this may be a bit moot. and sorry for the old thread posting.

but i ran into this just now. I had the exact same issue. i'm trying to run 'tvnamer' in this manner: $1 will be a tv show I have.

Code: Select all
/usr/local/bin/tvnamer -v -c /Volumes/Drobo/scripts/tvnamer/tvnamer.json $1 >> /Volumes/Drobo/logs/tvnamer.`date +%Y-%m-%d`.log 2>&1


I then look at my tvnamer log and I see this:

Code: Select all
Invalid path: -
Invalid path: -
Invalid path: /Volumes/Drobo/torrents/TV/TVUnsorted/New
Invalid path: Girl
Invalid path: Kryptonite.avi
Invalid path: [01x02]
Usage: tvnamer [options] <files>

tvnamer: error: No valid files were supplied
Loading config: /Volumes/Drobo/scripts/tvnamer/tvnamer.json
####################
# Starting tvnamer


if i type that into my terminal, it works. it seems to not be recognizing the dash parameters passed into 'tvnamer'?? or maybe i'm doing this wrong. I have the 'shell' input set to /bin/bash.
nleco
 
Posts: 8
Joined: Thu Apr 05, 2012 2:34 am

Re: Running shell script in Hazel Sun Feb 03, 2013 5:02 am • by nleco
after reading more posts. I tried adding double quotes around the $1 parameter, and it now works. :?
nleco
 
Posts: 8
Joined: Thu Apr 05, 2012 2:34 am

Re: Running shell script in Hazel Sun Jun 30, 2013 12:15 am • by phae_girl
I ran into these exact same problems with Octopress. If you want to read the long, ugly tale about how I sorted it out, you can find it here. The summary is that my .bashrc, .bash_profile and .profile were all screwed up. The other thing that helped a lot was to switch from *RVM* to *rbenv*.
phae_girl
 
Posts: 8
Joined: Mon Oct 15, 2012 1:57 pm

Previous

Return to Support