Rh 7.3 Q


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Rh 7.3 Q
# 1  
Old 03-09-2003
Rh 7.3 Q

Anyone know how to edit your .bash_profile so it can execute scripts rather then sh ./whatever

I tried just typing the file name of the script but it doesn't work.

I set the permsisions.

The reason i ask is that it's a pain having to type the sh ./whatever everytime you run a script especially for starting periodic processes like apache or mysql.


Oh one more... What is the file that decides what loads in boot (inittab is 3) the things like sendmail and ... basically the equivelent to autoexec.bat for redhat.
# 2  
Old 03-09-2003
for scripts and services started at boot and killed on shutdown or run level change see the directory:
/etc/rc.d/
# 3  
Old 03-09-2003
To run scripts like that, you'll have to modify your search path. Open your .bash_profile or .bashrc (the preferred file), and add a line like below:
Code:
export PATH="$PATH:."

You're just adding "." (a link to your current directory) to the end of your path, and keeping the rest as-is.

Keep in mind that you may run into issues, and it's much safer to use a full or relative path, especially as root. For example, say someone creates a script in /tmp named "test". If by some chance, "." ends up in the front of your path, and your pwd is in /tmp, you will run that test instead of /bin/test... More dangerous as root, but it's something everyone should get used to doing.

As for your boot question, Redhat uses /etc/rc3.d/* to start up programs. There is a nice interface to it: /usr/sbin/ntsysv
If you want to add some custom startup stuff (for example, I create and mount a Ramdisk each time I boot up on one of my machines), a simple way to do it without writing a huge script is just to add your script inline to /etc/init.d/rc.local (I think that's where it is - I don't have access to a Redhat machine, ATM).

Please keep in mind that this is run as root, and doing wierd things to your botup scripts can cause some trouble... always make backups of the file before modifying it, and test your code thoroughly.
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question