Find the answer to your Linux question:
Results 1 to 3 of 3
I have a bash file, I want that 1. whenever I reboot machine, this bash should run automatically. 2. Whenever a specific user logs in, it should run automatically. In ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    1

    > Running a bash file on machine boot up or user login


    I have a bash file, I want that

    1. whenever I reboot machine, this bash should run automatically.

    2. Whenever a specific user logs in, it should run automatically.

    In Short I want to know is there any place or folder (like Startup folder in Windows, ) where, if I put bash file, it will run automatically on rebooting machine.

  2. #2
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    What distribution are you using?

    Most distributions have a rc.local or similar file where you can put commands you want run on boot. The exact name and location varies from disto to distro, but it will be somewhere in /etc

    If you're using a graphical login, then you can put commands to be run on login in ~/.xinitrc if you're not using a graphical login, then you can put the commands in ~/.bashrc

    Most desktop envirnments have a sessions or startup manager you can use to add startup scripts/commands/programs as well.

  3. #3
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    525
    So in short, no there is no such thing as a start-up folder in most GNU/Linux distros. Most of us use boot scripts. Just like Darkrose mentioned.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •