Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm running SuSE linux 8.1 (totally awsome btw) and have the typical problem of a GUI configuration utilities rewrite my custom settings.
In my case my network interfaces try to load prior to pcmcia, and my realtek 8139 pcmcia card doesn't load. to solve the problem I have to change the names of the files in my /etc/init.d/rc5.d to re-order the boot processes.
what kind of script could i write that would, upon execution, automaticaly rename those files for me?
Yast, however handy it normally is, likes to go back and rewrite the boot files after certain types of configuration. Every few days I find myself having to manually rename three files. I was hoping that I could just write a script that root could run and rename them for me.
As an alternative you could also lock them against change by using "chattr +i </pathtoand/filename>". Doubt it Yast will detect they've the immutable bit set.
I do like scripts cuz theyre flexible, so if you want a script post what needs to change from what to what and we'll see.
I'd prefer a script so If I wanted to add or change actions it wouldn't be too difficult.
I need to change /etc/init.d/rc5.d/s08pcmcia
to " "s05pcmcia
/etc/init.d/rc5.d/s07hotplug
to " "s08hotplug
/etc/init.d/rc5.d/s05network
to " "s07network
As i don't have my computer in front of me, I'm giving those names and paths off of the top of my head, but they should be pretty close. Any suggestions on what a good script might look like? I've played with linux for a while, but am completely new to scripts.
#!/bin/sh
# Have runlevel, or replace by a fixed number
runlevel="$(/sbin/runlevel | awk '{print $2}')"
# Dir we gotta change stuff in
b=/etc/rc.d; bd=""$b"/rc"$runlevel".d"
# Not too subtle :-]
checkSlink() { rm -f ""$bd"/S??"$1""; ln -sf "$b"/init.d/"$1" "$bd"/S"$2""$1"; }
checkSlink pcmcia 05
checkSlink hotplug 08
checkSlink network 07
exit "$?"
One tip for "foreign" scripts is to echo all commands, then you'll see if variables are ok for instance, elif you believe the commands are ok, you could run it as "sh -x <script>" to see all variables expanded as well.
Thank you ever so much. It works great. I had to edit one of the paths, and it looked like there were an extra set of quotes laying around, but otherwise worked wonderfully. It ended up looking something like this for me:
#!/bin/sh
# Have runlevel, or replace by a fixed number
runlevel="$(/sbin/runlevel | awk '{print $2}')"
# Dir we gotta change stuff in
b=/etc/init.d; bd=""$b"/rc"$runlevel".d"
# Not too subtle :-]
checkSlink() { rm -f "$bd"/S??"$1"; ln -sf "$b"/"$1" "$bd"/S"$2""$1"; }
checkSlink pcmcia 05
checkSlink hotplug 08
checkSlink network 07
exit "$?"
now, two more questions.
1) where would be a good place to learn such scripts?
2) any idea how I could make my computer execute this on shut down?
Good it worked and thnx for the feedback, I appreciate that.
I do like excessive quoting, but even that can be affected by Mental Floss :-]
1) Lookup "Advanced Bash-Scripting Guide" (abs.tar.gz) at for instance tldp.org
2) Link into rc0.d and rc6.d and then you've covered reboot and shutdown.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.