LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I write a script (batch file)?? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-write-a-script-batch-file-469047/)

cvzyl 07-30-2006 03:02 AM

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

acid_kewpie 07-30-2006 03:08 AM

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.

tredegar 07-30-2006 03:09 AM

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

drkstr 07-30-2006 04:23 AM

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

cvzyl 07-30-2006 09:11 AM

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


All times are GMT -5. The time now is 05:42 AM.