Find the answer to your Linux question:
Results 1 to 7 of 7
hi I want to run c/c++ console (using ncurses) application as autorun application in a text mode.So what command i shld write in a inittab file.which settings I shld i ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46

    using inittab

    hi

    I want to run c/c++ console (using ncurses) application as autorun application in a text mode.So what command i shld write in a inittab file.which settings I shld i hv to make in a directory...

    Please explain me in detail.

    Thanks & Regards
    vineeta7

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    I've never done this, but it shouldn't be too difficult.

    Do this at the command line:
    Code:
    man inittab
    When you are familiar with the content of that man page, look at your inittab file. See how it sets up something on various virtual terminals. Choose one of those virtual terminals and replace the command in that line with a command that runs a script. It would probably not be a good idea to use virtual terminal 1 for this. In environments with which I am familiar, anything from 2 through 6 would be ok.

    In this script should be the name of a script that you write. Be sure to enter the full path name of that script, beginning with "/".

    In your script, you should do three things.

    First, the script is running as root, so use "su" to change your user ID to whichever one will be running the application.

    Second, set all the environment variables you need. You may not be aware of any particular ones. To get the list of environment variabls you should probably set, take the ones you already know about and add to them most of the ones you get by doing this at the command line:
    Code:
    env | sort | less
    If you don't know whether you can leave out a particular environment variable, include it.

    The third thing your script should do is run the program itself. Be sure to name the program using its full path name, starting with "/".

    I know this is general, but you can learn much about Linux by rolling up your sleeves and getting your fingernails dirty.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    You should probably be looking to put this in /etc/profile rather than inittab.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Quoth bigtomrodney:
    You should probably be looking to put this in /etc/profile rather than inittab.
    Good point. The question is this, vinetta7:
    1. Do you want this to run automatically when you log in as a certain user?
    2. Or do you want it to run without logging in at all, when you boot the system?

    If (1), then you want /etc/profile. If (2), then you want the inittab file, and of course you'd better be root, or have root as your friend.

    My assumption, since you had specifically mentioned the inittab file, was that you wanted (2).
    --
    Bill

    Old age and treachery will overcome youth and skill.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46
    yes I want to run it before login...

    till I am not getting exactly...Please tell me what command i shld write in inittab.... which folder i shld put my execuable file?????


    Please reply

    vineeta7

  6. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Sorry to go off-topic but wje: check your private messages.

  7. #7
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    The command in inittab should be the full pathname of the script which sets your environment variables, changes your user ID, and runs your program.

    Since this script is run as root, and since root can read anything it wants, you can put that script anywhere you want, and use that full pathname as the command to put into inittab.

    Your user program should be put in a directory that the user who is to run the program can use. The command within your script which runs that program should ordinarily provide the full pathname of that command.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

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