• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat shortcuts / aliases on OS X desktop

 
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can one add shortcuts (aliases) to the startup.sh and shutdown.sh for Tomcat/bin files on the Desktop in OS X?

With thanks!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a command-line kind of guy myself, but if you copy the script to your desktop, rename it from .sh to .command, and make sure that it has exec privs, it will become a 'clickable script'.

Bear in mind that its working directory will be your home folder so you may need to adjust the script accordingly.

You might also want to investigate Platypus for OS X, a tool that creates application wrappers for shell scripts.
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

There should also be an AppleScript solution, but I do not know how to tell your script about environmental variables. JAVA_HOME for instance.

Anyone have a thought about that?

Elton
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you having a specific difficulty? When the scripts run they inheret any variables from the shell just as one would expect.
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bear,

That is what I thought as well. ApplrScript seems to be of a different mind.

Background: I know nothing about AppleScript. I usually start and stop Tomact using a simple script. Works with no problems. I read the initial post in this thread and by pure coincidence later that day I went to the homepage of the Spring framework. They have a page on how to get Spring running on an MacOSX system. The page included instructions on creating an AppleScript to start and stop Tomcat.

Getting Spring to work on MacOSX

I opened Script Editor and entered 'do shell script "echo /usr/local/tomcat/jakarta-tomcat-4.1.27/bin/shutdown.sh | /bin/bash"' in the editor and compiled it. I ran the compiled script and it generated an error. The error is: "The JAVA_HOME environment variable is not defined
This environment variable is needed to run this program".

I am sure there is a simple way to do it. The variable is defined in my .bash_profile. The command 'echo $JAVA_HOME' prints the correct answer.

It might be interesting to solve this riddle, but I am not to worried as I use CLI for most of this anyway.

Thanks,

Elton
[ February 23, 2005: Message edited by: Elton Hughes ]
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem with the AppleScript has been solved. A property list was needed in an invisible folder in your home directory. Just follow the instructions in the linked in my earlier post.

Now as for why it was necessary in the first place, I have no idea.



Elton
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried doing the AppleScript by putting this in the script editor:

do shell script "echo /Developer/JavaTools/jakarta-tomcat-5.0.28/bin/startup.sh | /bin/bash"

And when I tried to save it as an application, it still didn't work!

Can anyone help?
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already have the .MacOSX directory under ~ and have a .plist file...

When I tried to create a application (Start Tomcat.app), that contained this:

do shell script "sh $CATALINA_HOME/bin/startup.sh"

A Syntax Error dialog box opened which stated:

"A identifier can't go after this identifier."

And after that it wouldn't let me save it...

Any suggestions, comments, feedback?

With thanks,
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Unnsse,

Try using the full path name for your script, instead of the variable. What happens then?

You wiill get it will work, I am sure. If I did, you can.

Best of luck,

Elton
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Elton,

I still can't get it to work... It still says:

Syntax Error:

"A identifier can't go after this identifier."

I did try the full path this time:

do shell script "echo /Developer/JavaTools/jakarta-tomcat-5.0.28/bin/startup.sh | /bin/bash"

Do I have it as an application? I tried to save it to my Desktop as the executable: "Start Tomcat.app"

I noticed single quotes in your posting surrounding the 'do shell script ...', are they needed?

Also, do I have to check on any of these:

- Run Only
- Startup Screen
- Stay Open

?

What could I possibly be doing wrong? Do I need the "| /bin/bash"?

What possibly am I doing wrong?
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Unnsse,

You have more questions than I can answer. I did save it as a script, but that is all I can remember. I have since dumped it because I use a Bash script to start and stop Tomcat.

As for your other questions, I have no answer. Sorry.

Elton
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

You might also want to investigate Platypus for OS X, a tool that creates application wrappers for shell scripts.



We've been trying to use Platypus on a shell script that requires sudo privileges, but it hangs on the sudo. According to someone else who ran into the same thing ( their story) we can't use Platypus to pass in the sudoer's password. Have you come up against this at all? Any tips?


Thanks,
Pauline
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, no sorry, I haven't tried any sudo-ed commands with Platypus.
 
Pauline McNamara
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Meanwhile we've figured it out. Well, OK, I asked the developer and he clued us in.

Just in case you ever do need to wrap up a script with sudos into a Platypus app, you only need to require admin authentication and then remove the sudos from the script.

Thanks for the original tip, Bear - Platypus really came in handy.
 
reply
    Bookmark Topic Watch Topic
  • New Topic