New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Some simple Unix / OS X Questions


Post Reply New Thread Subscribe

 
Thread Tools
starrin
Guest
 
Posts: n/a

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
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac 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

rman is offline
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!
QUOTE Thanks
MoltenLava
Guest
 
Posts: n/a

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.
QUOTE Thanks
Osiris22x

 
Osiris22x's Avatar
 
Member Since: Feb 25, 2004
Location: Portland, OR
Posts: 475
Osiris22x will become famous soon enough
Mac Specs: 15" MacBook Pro, 13" MacBook Black, 15" iMac G4, 24" iMac (soon!)

Osiris22x is offline
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
QUOTE Thanks
starrin
Guest
 
Posts: n/a

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????
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac 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

rman is offline
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!
QUOTE Thanks
MoltenLava
Guest
 
Posts: n/a

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.
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac 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

rman is offline
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!
QUOTE Thanks

Post Reply New Thread Subscribe


« Problem with Finder in OS X 10.3.4 | Getting files from 8.6 to X »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Unix VS. Linux dziner Switcher Hangout 27 12-04-2006 02:17 PM
Unix psychotoe OS X - Development and Darwin 6 06-16-2004 02:46 PM
A few simple questions martyn iPod Hardware and Accessories 1 02-29-2004 11:07 AM
Some simple questions! CaptainStandish Switcher Hangout 7 02-19-2004 10:23 AM
Apple in Court over UNIX Name schweb Apple Rumors and Reports 8 06-13-2003 10:54 PM

All times are GMT -4. The time now is 07:16 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?