LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-30-2006, 03:02 AM   #1
cvzyl
Member
 
Registered: Mar 2006
Distribution: openSUSE 10.2
Posts: 47

Rep: Reputation: 15
How do I write a script (batch file)??


I want to write a script/batch file (I am new to Linux so not sure what it should be called) that will start lampp. The command is /opt/lampp/lampp start and it must be executed as root.
I would prefer to have it start at system start-up, but alternatively I could launch it using a script.

How can I do this?

Thanks
Cobus
 
Old 07-30-2006, 03:08 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
open a text file, write the lines, save the file. there, you have a script. you'd probably also want to make it directly executable (chmod +x scriptname). i also assume suse uses /etc/rc.local which you can use to run system wide commands on boot.
 
Old 07-30-2006, 03:09 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,119

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
No need to "write a script".
Just put that command /opt/lampp/lampp start as the last line of the file /etc/rc.d/rc.local and it will be ecexuted (as root) the next time you boot
HTH
 
Old 07-30-2006, 04:23 AM   #4
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
If you are used to dos style script writing, your in for a pleasent surprise with bash scripts.

http://www.tldp.org/LDP/abs/html/

Very fun, very useful.

regards,
...drkstr
 
Old 07-30-2006, 09:11 AM   #5
cvzyl
Member
 
Registered: Mar 2006
Distribution: openSUSE 10.2
Posts: 47

Original Poster
Rep: Reputation: 15
Thank you for all the replies. tredegar, I'll try your method first as that is what I want to do, start the servers automatically at system start.

Thanks again.
Cobus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
any shell script 2 batch file tools? rosbur Linux - General 12 11-27-2018 12:20 PM
How to write script file in Linux? rust8y Linux - General 3 05-20-2006 05:49 AM
Backup script to write to file? ctroyp Linux - Newbie 13 01-10-2006 06:15 PM
php script can not write text file lemotion Linux - Newbie 5 04-20-2004 10:14 PM
Need help writing a batch/script file cbjhawks Linux - General 1 01-28-2004 05:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:14 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