Results 1 to 8 of 8
  1. #1
    starrin
    Guest
    Some simple Unix / OS X Questions
    Okay -- I am trying to become as efficient in my software development on my mac than I am in Windows.

    Where I have trouble is in configuration and command line stuff.

    For instance when I start a .bat file in Window (say - running a Servlet Engine like Tomcat) all the local process debug information goes to the screen.

    But when I use the .sh file in OS X from the command line - I get some startup parameters and then it starts in the background -- how do I get it so that I am getting all that good startup and debug information on my Terminal window as it is running -- I guess I am trying to figure out how to run it within the Terminal window.

    I was assuming it would off bat -- maybe the startup.sh file that starts the server is putting it in the background?

    Thanks for any help.

    Jason

  2. #2

    rman's Avatar
    Member Since
    Dec 24, 2002
    Location
    Los Angeles, California
    Posts
    12,584
    Specs:
    2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi
    Cool
    The script that you are running is run in the foreground, unless you put it in the background. What you need to do is trun on the verbose option. It has been a long time since I have written any shell scripts. I think for bourne shell, you run it with the -x option, but I would check to be sure (i.e. sh -x yourfilename).
    Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!

  3. #3
    MoltenLava
    Guest
    Quote Originally Posted by starrin
    I was assuming it would off bat -- maybe the startup.sh file that starts the server is putting it in the background?
    Without looking at what the script does I can only speculate, but I would say that's the most likely reason. Unix servers are traditionally made run in the background by default. And there is no standardized option to make the server process run in the foreground. Take a look at the script. Well written script should provide -h or -help option to show the available options, and in many cases you'll find the answer there.

  4. #4

    Osiris22x's Avatar
    Member Since
    Feb 25, 2004
    Location
    Portland, OR
    Posts
    475
    Specs:
    15" MacBook Pro, 13" MacBook Black, 15" iMac G4, 24" iMac (soon!)
    You just need to turn on the verbose options, as rman said. This is done with "-v". You'll find all the information you need by typing "man sh" at a command prompt, or you can find the SH manual pages online, here
    Roger Michaels
    Apple Certified Consultant

  5. #5
    starrin
    Guest
    Hi everyone -- thank you for the input. I do not think this script will output the output it sends to the logfile -- I have to look at the startup script to see if I can send parameters.

    One thing I did do is create a script that will automatically 'tail -f' the output file.

    One more question though -- how would one create a shell script that will set up a bunch of environment variables and then when the script is done the terminal window keeps the settings. I am exporting certain variables such as the following:

    export JAVA_HOME=/Library/Java/Home

    but when it returns from the script - it does not hold the environment variables????

  6. #6

    rman's Avatar
    Member Since
    Dec 24, 2002
    Location
    Los Angeles, California
    Posts
    12,584
    Specs:
    2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi
    Cool
    If you use the saqme values all the time, you may want to create a .profile file. Which contains all of your defined environment variables. This file is located in your home directory. Hopefully, someone will be able to answer your question.
    Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!

  7. #7
    MoltenLava
    Guest
    Quote Originally Posted by starrin
    Hi everyone -- thank you for the input. I do not think this script will output the output it sends to the logfile -- I have to look at the startup script to see if I can send parameters.

    One thing I did do is create a script that will automatically 'tail -f' the output file.

    One more question though -- how would one create a shell script that will set up a bunch of environment variables and then when the script is done the terminal window keeps the settings. I am exporting certain variables such as the following:

    export JAVA_HOME=/Library/Java/Home

    but when it returns from the script - it does not hold the environment variables????
    When you RUN a script, it will fork a shell process, then the script sets the env variables. When the forked shell process dies, the new variables go with it.

    What you want to do is "source" a script. There are variations depending on type of the shells, and on bash you just type

    # source <script name>

    Yes, you can keep it permanent by adding it to your .profile or .bashrc.

  8. #8

    rman's Avatar
    Member Since
    Dec 24, 2002
    Location
    Los Angeles, California
    Posts
    12,584
    Specs:
    2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi
    Cool
    To add to what MoltenLava stated:

    for cshell (csh), bourne shell (sh)

    source filename

    for korn shell (ksh)

    . filename
    Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. a few really simple questions
    By mzimmers in forum OS X - Development and Darwin
    Replies: 6
    Last Post: 08-23-2010, 07:12 AM
  2. Just a few simple questions
    By Carmen89 in forum Switcher Hangout
    Replies: 16
    Last Post: 09-23-2008, 05:45 AM
  3. Simple Questions
    By dehaitest in forum Apple Notebooks
    Replies: 7
    Last Post: 03-24-2008, 04:02 AM
  4. A Few Simple Questions
    By 651 in forum OS X - Operating System
    Replies: 2
    Last Post: 04-11-2007, 08:54 AM
  5. Running UNIX Programs On My Mac, Questions
    By ezhangin in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 11-02-2005, 09:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •