gem-in-eyez Posted March 22, 2006 Report Share Posted March 22, 2006 (edited) Noob here that is seeking help with making a script to start a voice server application. I have a ventrilo server installed in my box. I want to write a script that issues this command for the working directory of the application ./ventrilo_srv (/usr/ventrilo). now when I am in the cosole i can start the server by simply issueing the command ( ./ventrilo_srv). I would like to have this application start on boot up after everything else services, daemons, etc and such are done and loaded successfuly. I was reading a post (https://mandrivausers.org/index.php?showtopic=5084) where it talks about starting program on the boot process. I tried to /etc/rc.local by adding a statement as it said to. but not getting it to work. pretty much i am also new to scripting so i have not completely understood the whole scripting concept and are still basing what i do understand on dos batch writing. However, I was able to create a test script that does launch the server. now my question and problem is related to how to insert the same command(s) in the rc.local script or the inittab to start my server. I would like it if someone was able to just show me how to go about this so that I can properly understand and get the server up and running. by this then I can get a clear, working example that I can then elaborate on or recreate with other applications aswell. if this is not worded correctly feel free to say so and I will give step by step instructions to what I have done. i have mandrake 9.1 installed because I want to understand my box first before I do a fresh install of the newer versions. Edited March 28, 2006 by gem-in-eyez Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted March 23, 2006 Report Share Posted March 23, 2006 Can you post the script you use to start your server (the one that works when you run it from command line) and exactly what you put in rc.local? Quote Link to comment Share on other sites More sharing options...
gem-in-eyez Posted March 25, 2006 Author Report Share Posted March 25, 2006 thnx for the reply and the possible help. the script i created has this code: # # This is a self made script to launch ventrilo # It runs in conjuction wuth /etc/inittab to autostart should it be killed or rebooted ## # # cd /usr/ventrilo ./ventrilo_srv I basically called it ventscript.sh (which when I want to run, i go to the dir and type ./ventscript.sh and is runs. I then placed it in the working directory (/usr/ventrilo) until I figured where i could place it ...thinking like windows (start up folder) or anything of the same in my linux box. I then went to the inittab file (/etc/inittab) and added this line at the end: # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 r1:2345:respawn:/usr/ventrilo/ventscript.sh When it did not work i left the inittab as is with the modification and then tried to mod the rc.local file: fi elif [ $SECURE_LEVEL -ge 4 ]; then rm -f /etc/issue /etc/issue.net cd /usr/ventrilo . /usr/ventrilo/ventrilo_srv fi Now I am not familiar on how this should have been placed if I needed to create a new section with fi ..my code as above...fi so i decided to leave it as is as you see above. as you can tell i still have the windows train of thought so I think that is my main issue here. I figure that if i can see from a working example that works in my system that I can then replicate it for other things that I would like to do with my box. is there a good place that you could point me to on scripting for noobs. Looking for that red pill to set me free! Again thanks for the help Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted March 25, 2006 Report Share Posted March 25, 2006 It should work if you put cd /usr/ventrilo . /usr/ventrilo/ventrilo_srv or /usr/ventrilo/ventscript.sh in rc.local after the fi If not, I can probably help you create a service script for it. Quote Link to comment Share on other sites More sharing options...
gem-in-eyez Posted March 25, 2006 Author Report Share Posted March 25, 2006 Thanks alot. I guess maybe what I did accidentally was have the cd too close to the /usr/ventrilo. For some reason when I spaced them out and restarted the box it started working. I also noticed that when I went to the box to see what would appear on the screen, I saw that it loaded the script up on the tty1 out of the 6. Is this normal for scripts to do? ** I never do any actual work on the box itself, it is always done through secure ssh1*** Reason why I am asking is that I was assuming that it would run in a background like atmosphere, similar to when I boot up and see all the services that are loaded, ie: samba, httpd, nfs, inetd, etc... Either way it is working now. Last question I would like to ask is, what is with the fi? is it like html coding where you insert what you want to be modified or handled by the tags? Thanks again....Just gotta love taking that red pill! Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted March 26, 2006 Report Share Posted March 26, 2006 The 'fi' is part of the conditional statement in bash/shell scripting. let x=1; if [x eq 2]; then echo "test"; fi if [x eq 1]; then echo "something else"; fi it checks to see if x eq 2 and if it does, then it executes everything up until 'fi' . As for echoing to tty1, I will have to check into that. Quote Link to comment Share on other sites More sharing options...
gem-in-eyez Posted March 28, 2006 Author Report Share Posted March 28, 2006 Mucho Gracias!! Not only did it work, but you explained it in such a way that any lamer could understand! Now to the next part of my box! :P Mighty Grateful! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.