LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-31-2007, 05:13 AM   #1
shorun
Member
 
Registered: Mar 2006
Location: belguim
Distribution: fedora, mandriva, suse
Posts: 148

Rep: Reputation: 15
simple bash scripting help


ok, this is what i got:

#start of script
startapache)
if [ -e /var/run/pid ]; then
echo apache is allready running
else
/etc/init.d/httpd start
fi
;;
and it gives a command like this: ./script startapache
but i want to do ./script apache start
how do i do this?

is it like this?

#start of script
apache)
start)
/etc/init.d/httpd start
;;
stop)
/etc/init.d/httpd stop
;;
;;

if i do this, i just won't run. what am i doing wrong?
 
Old 07-31-2007, 06:11 AM   #2
lakris
Member
 
Registered: Sep 2004
Location: Stockholm, Sweden
Distribution: Ubuntu, RedHat, SuSe, Debian, Slax
Posts: 102

Rep: Reputation: 15
Don't You have the start and stop scripts that come along with apache?
Otherwise, take a look at the service start/stop scripts that reside in /etc/init.d/ (or where Your distro puts them) and just copy and modify one.

/Lakris
 
Old 07-31-2007, 07:26 AM   #3
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
In your other scripting needs, take a look at linuxcommand.org if you have time.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Scripting Help hopspitfire Linux - General 2 06-12-2007 04:46 PM
simple scripting help please kb100 Programming 3 08-18-2006 08:08 AM
Very simple BASH scripting question clickster Linux - Newbie 6 11-23-2005 04:28 PM
Simple bash/awk/sed scripting question R00ts Programming 4 04-16-2005 02:55 AM
Bash Scripting--Simple Question mooreted Linux - General 4 05-10-2004 01:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration