Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat startup script permission on Mac OS X

I'm struggling with a Mac OS X 10.5.8 that I've started using recently for development. I successfully installed tomcat and create launchd.conf for my environment variables.

I believe it works fine. Coz I can build a project with Netbeans using maven and cargo plugins successfully so i found online a script for start and stop the tomcat

#!/bin/bash

case $1 in
 start)
  sh /Library/apache-tomcat-6.0.20/bin/startup.sh
 ;; 
 stop)
  sh /Library/apache-tomcat-6.0.20/bin/shutdown.sh
 ;;
 restart)
  sh /Library/apache-tomcat-6.0.20/bin/shutdown.sh
  sh /Library/apache-tomcat-6.0.20/bin/startup.sh
 ;;
 *)
 echo "Usage :start|stop|restart"
 ;;
 esac
 exit 0

That script was created in nano in sudo sh but when i want to run it. is spit out this

sh: /usr/bin/tomcat: Permission denied

I've added chmod 755 *.sh and *.bat inside /Library/apache-tomcat-6.0.20/bin

Still access denied so what do I go around that? I have the admin privileges on the machine.

Thanks for reading

like image 726
black sensei Avatar asked Nov 02 '09 17:11

black sensei


2 Answers

Go to Tomcat bin directory and run the below command:

chmod +x *.sh

This worked for me.

like image 175
denzal Avatar answered Sep 20 '22 05:09

denzal


Where did you install the tomcat script to? I'd recommend you install it to /usr/bin. Once installed, make sure the permissions are correct (i.e. chmod 755 /usr/bin/tomcat). You can then confirm with ls -l /usr/bin/tomcat.

If you still get errors once the permissions on /usr/bin/tomcat are correct, then you can add the following two lines following the #!/bin/bash line.

set -x
set -v

With the above lines, bash will output additional information that will allow you to tell what's being executed and where the error is happening.

like image 37
Kaleb Pederson Avatar answered Sep 20 '22 05:09

Kaleb Pederson