Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I am very new to Linux. I am using an old version of RedHat(7.2) and I want to start a program when linux boots. What I basicly want is ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    3

    I want to run a script after logging in.

    Hi,
    I am very new to Linux. I am using an old version of RedHat(7.2) and I want to start a program when linux boots. What I basicly want is when somebody turns on my linux box it opens and then directly runs a premade script that launches a program. This script is located in usr/Program/sProgram/SCRIPS/startALL.sh. So I want it such that it logs in the gui right away and then opens a terminal and run this script. Please help, I have been searching for 2 days now.

    Thank you.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    In your home directory you will find a file called .bashrc. It's a hidden file (like all files whose names begin with a ".") but you can display it using ls -a on the command line or, if you are working graphically, by setting your file manager to show hidden files. The instructions in this file will be obeyed each time you start the shell. So just insert a call to your shell script into .bashrc.

    If you want this script to be run only when you log in and not whenever you start a shell in an xterm, use .bash_profile rather than .bashrc.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Posts
    3
    I am doing this and it isnot working. I wrote the path to the script in both .bash and it doesnt do anything.

    I added this:
    usr/Program/sProgram/SCRIPS/startALL.sh

    to the end of each .bash and it doesnt work. It loads gnome and then nothing

  4. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    You could add the script to the list of programs started automatically whenever GNOME runs. To do this, look for "sessions" somewhere in the menu and then from the dialogue box, add the command to run your script (and if there is an option to choose to run the program from the terminal, select it).

  5. #5
    Just Joined!
    Join Date
    Oct 2007
    Posts
    3
    I did that, i added the command /usr/Program/script.sh
    Now it runs in the backround but i would like to be able to see it the response fromt he script in a terminal.

    I tried: xterm -e /usr/Program/script.sh but it opens an ugly terminal, runs for like not even a second and then closes. What can i do. OR is there a way that in my script, i can write something to open a terminal and then run the contents of my script and then no close when done?

Posting Permissions

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