how to run a shell scripts at every login in Centos

14,529

You can add your script in ~/.bash_profile where ~ represents the homedir of the user for which running the script is intended.

Share:
14,529

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    Actually i want to run my shell script at every time when a user login as well as at boot. i have tried using using crontab but it runs only at boot not at every login.so please tell me how to do this.

    #crontab -e
    @reboot  /home/user/test.sh
    
  • HBruijn
    HBruijn about 8 years
    That will work, as long as users don't change their shell, and/or don't edit their personal .bash_profiles. Better would be in in the system default /etc/profile or better still in an include such as /etc/profile.d/local.sh