Jump to content

how to run a script before starting X [solved]


Recommended Posts

Hi!

 

I want my OS to run one command every time on boot before startx (X)

(on runlevel 5 and 3)

 

I want it as root run something like this: /usr/share/program/program -param1 -param2

 

Where do I write in that command line in Fedora as well as in Mandriva?

 

Thanks, you're the best!

Link to comment
Share on other sites

Anotehr place: Daemons / services are usually started from /etc/init.d/ via the System V init system. You can define for which run levels this should be done, so level 3 and 5 in your case.

 

Yet another place: .bash_profile (per user) or /etc/profile (all users) after their logon has been completed.

Link to comment
Share on other sites

Anotehr place: Daemons / services are usually started from /etc/init.d/ via the System V init system. You can define for which run levels this should be done, so level 3 and 5 in your case.

 

Yet another place: .bash_profile (per user) or /etc/profile (all users) after their logon has been completed.

I concur with the above. Commands/scripts which you want to run after all init scripts have finished and before X starts must be put in /etc/rc.local which is symlinked to /etc/rc.d/rc.local:

$ head /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

Link to comment
Share on other sites

When placing commands in .xinitrc use an ampersand at the end of each command except the last one to enable the script to coontinue until all commands are completed.

Example:

rxvt -geometry 108x44+0+0 &

exec startkde

IMHO, .xinitrc is not always a right place to put commands. As the name suggests, this file is for X init stuff - like in the example above. If the commands you want to use are not related to X (e.g., networking, printing, starting/stopping daemons, mounting/remounting of partitions), place them in rc.local

Link to comment
Share on other sites

Well, the problem was that FC didn't detect my laptop wide screen correctly and didn't offer resoltuions I needed.

Hacking xorg didn't fix the problem, because it was a chip bios problem.

So I found out on the net that there is a special script (915 resolutions) that fixes my problem.

Unfortunately it had to be launched in a no X environment.

 

Anyway, because of a problem with wifi I installed Mandriva ONE 2007 on my laptop and upon resolution selection it offered me to automatically install 915 resolutions and set it up to launch it every time before X upon boot. :thumbs:

So my solution in this case is to run Mandriva ONE instead of Fedora Core 6 on my laptop. :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...