LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-01-2004, 07:32 AM   #1
e-nDrju
LQ Newbie
 
Registered: Mar 2004
Location: Poland
Distribution: openSUSE 11.4
Posts: 16

Rep: Reputation: 0
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?
 
Old 04-01-2004, 07:55 AM   #2
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
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'
 
Old 04-02-2004, 03:46 PM   #3
dav7500
Member
 
Registered: Feb 2004
Posts: 45

Rep: Reputation: 15
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!
 
Old 04-03-2004, 07:03 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
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'
 
Old 04-05-2004, 09:32 AM   #5
dav7500
Member
 
Registered: Feb 2004
Posts: 45

Rep: Reputation: 15
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!
 
Old 04-05-2004, 09:37 AM   #6
e-nDrju
LQ Newbie
 
Registered: Mar 2004
Location: Poland
Distribution: openSUSE 11.4
Posts: 16

Original Poster
Rep: Reputation: 0
thanks. that was very helpful
 
Old 04-05-2004, 10:06 AM   #7
dav7500
Member
 
Registered: Feb 2004
Posts: 45

Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mii-tool in tcpip package eeades Slackware 1 08-13-2005 09:36 PM
making changes permanent through mii-tool simplyrahul Linux - Networking 1 11-20-2004 12:56 PM
mii-tool lie to me czezz Linux - Networking 1 11-09-2004 05:07 AM
mii-tool showing 100mbps TheRealDeal Linux - Networking 1 09-01-2004 07:03 PM
A question about mii-tool yi.zhang Linux - Networking 2 04-02-2004 11:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration