Running a shell script

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

Moderator: Mr_Noodle

Running a shell script Mon Mar 18, 2013 6:13 pm • by chobhamonian
Hi...completely new to Hazel and having a nightmare running a shell script!

I've read as much as I can find about using full path names to commands etc and the fact that Hazel runs the command in a non-interactive terminal, but I can't get my command to run. I'm trying to get Hazel to run a "make HTML" command so that when any restructured text file in a directory is modified, my Sphinx Python documentation website gets rebuilt.

In I terminal window I do this...
Code: Select all
#cd Documents/sphinks_astun
make html


...and all works fine...the make command operates on a makefile in the sphinks_astun directory and all is fine.

In Hazel, I've set it to run an external shell script when any of the files are changed. I've altered the script to add full path names, so my shell script is like this...

Code: Select all
#!/bin/bash

#cd /Users/myname/Documents/sphinks_astun

/usr/bin/make html


When Hazel tries to process the rule though I just get "shell script exited with non-successful status code:2"

Any help would be appreciated. (new to Hazel and shell scripts!!)
chobhamonian
 
Posts: 4
Joined: Mon Mar 18, 2013 6:00 pm

Re: Running a shell script Tue Mar 19, 2013 11:17 am • by a_freyer
Have you tried specifying the makefile with:

make -f myMakeFile
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Running a shell script Tue Mar 19, 2013 12:01 pm • by chobhamonian
Hi , thanks for the response....I just adjusted my shell script to the following....but I'm still getting a shell script exit error message code 2??

Code: Select all
#!/bin/bash

#cd /Users/myname/Documents/sphinks_astun

/usr/bin/make  -f /Users/myname/Documents/sphinks_astun/Makefile html
chobhamonian
 
Posts: 4
Joined: Mon Mar 18, 2013 6:00 pm

Re: Running a shell script Tue Mar 19, 2013 12:04 pm • by a_freyer
are you seeing any output in the Hazel log?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Running a shell script Tue Mar 19, 2013 12:16 pm • by chobhamonian
This is an extract from the log...

Code: Select all
2013-03-19 15:59:25.233 hazelworker[1138] snn_live_planning_app_capture.rst: Rule Rebuild Documentation Website matched.
2013-03-19 15:59:26.516 hazelworker[1138] [Error] Shell script failed: Error processing shell script /Users/jrrutter/Documents/sphinks_astun/hazelscript.sh on file /Users/jrrutter/Documents/sphinks_astun/snn_live_planning_app_capture.rst.
2013-03-19 15:59:26.516 hazelworker[1138] Shellscript exited with non-successful status code: 2
2013-03-19 15:59:26.546 hazelworker[1138] Done processing folder sphinks_astun
chobhamonian
 
Posts: 4
Joined: Mon Mar 18, 2013 6:00 pm

Re: Running a shell script Tue Mar 19, 2013 12:19 pm • by a_freyer
and you did say that this script works fine executed from the terminal?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Running a shell script Tue Mar 19, 2013 12:25 pm • by chobhamonian
Yep, no probs at all...I just navigate to the directory containing the makefile and run make html and Sphinx rebuilds the html files from the unstructured text files.
chobhamonian
 
Posts: 4
Joined: Mon Mar 18, 2013 6:00 pm

Re: Running a shell script Tue Mar 19, 2013 12:40 pm • by a_freyer
your problem is likely with sphinx. Determine if there are any paths or environment variables it relies on.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado


Return to Support