LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mii-tool autostart with redhat9 (https://www.linuxquestions.org/questions/linux-newbie-8/mii-tool-autostart-with-redhat9-164921/)

e-nDrju 04-01-2004 07:32 AM

mii-tool autostart with redhat9
 
hi! ebery time when I start my rh9, i must use mii-tool to set my network media type to 10baseT-HD. So i have to go to mii-tool directory, and run:

./mii-tool -A 10baseT-HD
/.mii-tool -F 10baseT-HD

Can I do something, if i want to autorun these commands on startup?

Oliv' 04-01-2004 07:55 AM

Hello,

Of course you can do that automatically at each boot :)
You have to put the two lines in a script in /etc/rc.d/init.d/ directory (I am not sure for the path... but the final directory is init.d). Either you put it at the end of the networking script or you create a new script and in this case you have to make a symlink with the runlevel directory you run each time you boot :) (If I'm not clear enough, tell me).
Hope this help you

Oliv'

dav7500 04-02-2004 03:46 PM

Similar topic question. I'm running RH9.
How would I create a file to autostart some commands? I can create the file with the cmds in there & chmod to 755.

Where do I place this file?
Does it need a special name?
How/where to I setup the symlink stuff?

Thanks!

Oliv' 04-03-2004 07:03 AM

Hello,

Quote:

How would I create a file to autostart some commands?
like a bash script :)
Quote:

Where do I place this file?
in a init.d directory which is located somewhere in /etc
Quote:

Does it need a special name?
No
Quote:

How/where to I setup the symlink stuff?
Very interesting question :) First your symlink need a special name. For example if you file in init.d is named foo, then you will have to name his symlinks S90foo if it's a start script and K20foo if it's a kill script. So the rule is the following: for a start script, the symlink keeps the same name with a prefix which is S and a number. The S means that "start" will be passed as an argument to your script and the number is to determine the order to run scripts. So for a kill script that's the same rule and the prefix is a K.
After this explanation, I have to add that your script can do both: start or kill a process. For example, my devfsd start/kill script:
Code:

case "$1" in
        start)
                echo "Starting devfs daemon..."
                loadproc /sbin/devfsd /dev
                ;;
        stop)
                echo "Stopping devfs daemon..."
                killproc /sbin/devfsd
                ;;
        restart)
                $0 stop
                sleep 1
                $0 start
                ;;
        status)
                statusproc /sbin/devfsd
                ;;
        *)
                echo "Usage: $0 {start|stop|restart|status}"
                exit 1
                ;;
esac
exit 0

Now the problem is to know where to do the symlink... For that you need to know the runlevel you boot (have a look at /etc/inittab file to know it... but that's probably 5). So imagine that when you, your runlevel is 5 and you want to add a startup script. Then put it in init.d directory and go in rc5.d directory. Then type the following:
Code:

ln -s ../init.d/myscript S90myscript
If your script run a background task that you want properly quit when you shutdown your computer, then do the same in rc6.d (for reboot) and rc0.d (for shutdown) with kill argument.
Hope this help you

Oliv'

dav7500 04-05-2004 09:32 AM

So, I created a file called "symstart" in my init.d directory. The file has one line: "synergyc 1.2.3.4". I also did "chmod 755 symstart".

Then, I ran "ln -s ../init.d/synstart S90synstart" from the rc5.d directory.
After rebooting, it didn't really work. The prg ran during logon but afterwards, wasn't running. (same status as before)

Next, I tried the following, which resolved my problem (form some other post):

/etc/X11/gdm/PreSession/Default
add the lines

code:--------------------------------------------------------------------------------
# Kills the login's synergyc process
# so that the user's script can restart it
/usr/bin/killall synergyc
sleep 1
--------------------------------------------------------------------------------


in /etc/X11/xdm/Xsession
add the lines

code:--------------------------------------------------------------------------------
# Runs synergyc as the user
/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc [your synergy host]




Thanks anyway!

e-nDrju 04-05-2004 09:37 AM

thanks. that was very helpful

dav7500 04-05-2004 10:06 AM

I forgot a key point - it may be helpful to insert those lines at the top of the script since it may not be executed if simply place at the end.

Original post link: http://www.linuxquestions.org/questi...244#post859244


All times are GMT -5. The time now is 07:16 PM.