LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Where to put some sh ... (https://www.linuxquestions.org/questions/linux-software-2/where-to-put-some-sh-345942/)

tareqth 07-23-2005 05:29 AM

Where to put some sh ...
 
I'd like to put some shell scripts to run everytime the user logs in, and some other scripts to run everytime the system starts. Can you help me where to put them ?

Thanx

XavierP 07-23-2005 05:53 AM

Which distro are you running and what do the scripts do?

RomanG 07-23-2005 06:07 AM

Usually you can put it in users ~/.bash_profile file
Code:

[root@squirrel etc]# cat /home/roman/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME

echo
/usr/games/fortune
echo
[root@squirrel etc]#

To run some scripts when your system starts you usually can
add them to /etc/rc.d/rc.local script file. But as XavierP said it depends on your distro.
:study: :study: :study:

tareqth 07-23-2005 10:05 AM

I use RHEL 4

RomanG 07-23-2005 12:10 PM

Yes, it's OK for you if you follow them.
Notice that users can modify their ~/.bash_profile and ~/.bashrc scripts, so if you want to start some scripts/programms when user logs in the system and don't want to allow that user to bypass it, you should run your scripts/programms from /etc/zlogin or /etc/zprofile scripts.


All times are GMT -5. The time now is 05:26 PM.