Sponsored Content
Top Forums Shell Programming and Scripting Problem with looping construct Post 302087916 by mikie on Thursday 7th of September 2006 06:26:41 AM
Old 09-07-2006
Hi Blowtorch

Thanks for the reply, and the input. I used the method you suggested - running the "ps" inside the while loop - and it worked. What I don't understand is why this did not work in my original script as within the while loop, there is the call for the command substitution:

Code:
HTTPD=`/bin/ps -axcu | /usr/bin/grep httpd >/dev/null; echo $?`

while [ ${HTTPD} -eq 0 ];
do
echo "Apache is still running..."
done

Prehaps this is highlighting gaping holes in my knowledge Smilie

Mike
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: looping problem!

I am having a problem with awk when I run it with a loop. It works perfectly when I echo a single line from the commandline. For example: echo 'MFG009 9153852832' | awk '$2 ~ /^0-9]$/{print $2}' The Awk command above will print field 2 if field 2 matches 10 digits, but when I run the loop... (5 Replies)
Discussion started by: cstovall
5 Replies

2. Shell Programming and Scripting

ksh construct

Hi Guys, could someone tell me what this ksh construct does typeset -r PROG_PWD=${0%/*} does I understand the -r for readonly but I would very much appreciate a definitive account of what this will set $PROG_PWD to. If I run this at the cmd line it it gets set to /usr/bin but I would... (2 Replies)
Discussion started by: ajcannon
2 Replies

3. Shell Programming and Scripting

Problem with looping the directories

Hi all, I have a directory which has many sub-directories. Now, I want to check the space of each dir and redirect the output in a file if space exceeds the limit. I have already done it, but the way I did is not very good. I just listed the directories and awked the last column to get the... (5 Replies)
Discussion started by: naw_deepak
5 Replies

4. Shell Programming and Scripting

if-else construct not working

Hi all, Sorry to ask this easy question but I am stuck. In a scenario i am executing one shell script which contains a if - else construct : if ; then echo $line $line >> successful_build.txt else $line >> failed_services.txt fi explaination : if the... (5 Replies)
Discussion started by: bhaskar_m
5 Replies

5. Solaris

SVM Solaris 8 Problem. Metastat output looping

Hi friends, I'm newbie to SVM. Just wanna try installed it on one of our server (to do mirroring for disk0 and disk1) but i think im lost until now. :( the steps i've taken is as below:- 1.prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2 2.metadb -a -c 3 -f c1t0d0s7... (3 Replies)
Discussion started by: kronenose
3 Replies

6. Shell Programming and Scripting

Help with if-else construct

Hi all i have been trying to do a small 'question and answer' script using if-else statement and a combination of pipe. I have succeeded in allowing the user to login with user name and password stored in a sequence username/password in a file named "pass" like this: echo "please enter your... (14 Replies)
Discussion started by: arikutex
14 Replies

7. Shell Programming and Scripting

looping problem

I have been trying to come up with a program that can do this: Say I have a file named "sir" with a single field; 10 229 288 35 83 47 3 I want to create a file "gen" with three fields with the data in file "sire" listed in field 1 while field 2 and 3 are just 1 each like this: SPARSE... (1 Reply)
Discussion started by: iconig
1 Replies

8. Shell Programming and Scripting

perl: problem in looping! how to get rid

Hi i just want to open 2 files and find difference between cond1 and cond2 and if the difference is greater than or equal to some number say 2 print the lines again in 2 different files. file 1 (1.txt) aqw dfr 34 poilo ggg 98 file 2 (2.txt) qww asd 28 poilo ggg 97 open FILE1,"1.txt" or... (2 Replies)
Discussion started by: anurupa777
2 Replies

9. Shell Programming and Scripting

Problem with Looping

Hi, guys, What I want is exactly shown below (I modified the former image and it looks like clearer.) https://lh6.googleusercontent.com/-EG8SKkrWEvc/Ube9e-jDiHI/AAAAAAAAAOM/hFNT0UqQPWE/s512/Linux_Study_20130611_001.jpg And with some guys' help, I made it. My script is below: #!/bin/bash #... (20 Replies)
Discussion started by: franksunnn
20 Replies

10. Shell Programming and Scripting

Looping problem

I need help. I am trying to get this script to send out only one email not multiple emails of the abend. Currently it will send me one then and ther with the first and second one then another email with the first second and third abend and so on. I only want one email sent. ... (2 Replies)
Discussion started by: bbcarosi
2 Replies
HTTPD(8)							       httpd								  HTTPD(8)

NAME
httpd - Apache Hypertext Transfer Protocol Server SYNOPSIS
httpd [ -d serverroot ] [ -f config ] [ -C directive ] [ -c directive ] [ -D parameter ] [ -e level ] [ -E file ] [ -k start|restart|grace- ful|stop|graceful-stop ] [ -R directory ] [ -h ] [ -l ] [ -L ] [ -S ] [ -t ] [ -v ] [ -V ] [ -X ] [ -M ] [ -T ] On Windows systems, the following additional arguments are available: httpd [ -k install|config|uninstall ] [ -n name ] [ -w ] SUMMARY
httpd is the Apache HyperText Transfer Protocol (HTTP) server program. It is designed to be run as a standalone daemon process. When used like this it will create a pool of child processes or threads to handle requests. In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems or as a service on Win- dows NT, 2000 and XP and as a console application on Windows 9x and ME. OPTIONS
-d serverroot Set the initial value for the ServerRoot directive to serverroot. This can be overridden by the ServerRoot directive in the configu- ration file. The default is /etc/httpd. -f config Uses the directives in the file config on startup. If config does not begin with a /, then it is taken to be a path relative to the ServerRoot. The default is conf/httpd.conf. -k start|restart|graceful|stop|graceful-stop Signals httpd to start, restart, or stop. See Stopping Apache httpd for more information. -C directive Process the configuration directive before reading config files. -c directive Process the configuration directive after reading config files. -D parameter Sets a configuration parameter which can be used with <IfDefine> sections in the configuration files to conditionally skip or process commands at server startup and restart. Also can be used to set certain less-common startup parameters including -DNO_DETACH (prevent the parent from forking) and -DFOREGROUND (prevent the parent from calling setsid() et al). -e level Sets the LogLevel to level during server startup. This is useful for temporarily increasing the verbosity of the error messages to find problems during startup. -E file Send error messages during server startup to file. -h Output a short summary of available command line options. -l Output a list of modules compiled into the server. This will not list dynamically loaded modules included using the LoadModule directive. -L Output a list of directives provided by static modules, together with expected arguments and places where the directive is valid. Directives provided by shared modules are not listed. -M Dump a list of loaded Static and Shared Modules. -S Show the settings as parsed from the config file (currently only shows the virtualhost settings). -T (Available in 2.3.8 and later) Skip document root check at startup/restart. -t Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests with either a return code of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D DUMP_VHOSTS is also set, details of the virtual host con- figuration will be printed. If -D DUMP_MODULES is set, all loaded modules will be printed. -v Print the version of httpd, and then exit. -V Print the version and build parameters of httpd, and then exit. -X Run httpd in debug mode. Only one worker will be started and the server will not detach from the console. The following arguments are available only on the Windows platform: -k install|config|uninstall Install Apache httpd as a Windows NT service; change startup options for the Apache httpd service; and uninstall the Apache httpd service. -n name The name of the Apache httpd service to signal. -w Keep the console window open on error so that the error message can be read. Apache HTTP Server 2012-02-10 HTTPD(8)
All times are GMT -4. The time now is 07:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy