LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-01-2005, 04:24 PM   #1
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Rep: Reputation: 47
script execution on halt


Thanks to masonm, I was able to get my PCMCIA nic configured right when I boot my laptop. It has to do with files not being deleted on shutdown. I wrote a small script that I need to execute on shutdown:

cd /etc/dhcpc
mv -f dhcpcd-eth0.cache dhcpcd-eth0.cache.bak
mv -f dhcpcd-eth0.info dhcpcd-eth0.info.bak
mv -f dhcpcd-eth0.pid dhcpcd-eth0.pid.bak

Now I just need to figure out how to make this script auto-execute when I log out (I tried putting it in /etc/rc.d/rc.6 and it didn't work right).

Any ideas on how to do that?
 
Old 04-01-2005, 04:33 PM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Assuming by "logout" you mean "shutdown", you need to put the script (or more preferably, a symlink to it) in the /etc/rc.d/rc0.d directory as well.
 
Old 04-01-2005, 04:36 PM   #3
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Where did you put it in rc.6? Location within the script would be everything, as you'd need to execute the commands after the network is shutdown but prior to the filesystem being unmounted.
 
Old 04-01-2005, 06:59 PM   #4
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
I did mean shutdown. I put the following lines after the dhcpcd shutdown in /etc/rc.d/rc.6:

rm /etc/dhcpc/dhcpcd-eth0.cache
rm /etc/dhcpc/dhcpcd-eth0.info
rm /etc/dhcpc/dhcpcd-eth0.pid

This worked for a couple boots-then I couldn't get online again. I commented out the lines and am back to executing the script manually when I successfully get an IP address.
 
Old 04-01-2005, 07:09 PM   #5
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
How about it this way.
create script like this called /etc/rc.d/init.d/dhcp_cleanup
Code:
#!/bin/bash
mv -f /etc/dhcpc/dhcpcd-eth0.cache /etc/dhcpc/dhcpcd-eth0.cache.bak
mv -f /etc/dhcpc/dhcpcd-eth0.info /etc/dhcpc/dhcpcd-eth0.info.bak
mv -f /etc/dhcpc/dhcpcd-eth0.pid /etc/dhcpc/dhcpcd-eth0.pid.bak
Now make it executable by ' chmod +x /etc/rc.d/init.d/dhcp_cleanup '
Now make a softlink to your rc6.d ' ln -s /etc/rc.d/init.d/dhcp_cleanup /etc/rc.d/rc6.d/K50dhcp_cleanup '

If not needed why not delete them instead of renaming.

Brian1
" Google the Linux way @ http://www.google.com/linux "

Last edited by Brian1; 04-01-2005 at 07:11 PM.
 
  


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
script execution error linux_lover2005 Programming 3 12-22-2004 06:46 AM
#! does not seem to work in cgi-bin?? (script execution) servnov Linux - General 6 12-06-2004 07:23 AM
script execution Johng Programming 2 08-21-2004 04:58 PM
Speeding up Shell Script execution?? funkymunky Programming 8 07-16-2004 08:39 PM
auto execution script nimrod Linux - General 2 12-09-2002 03:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:57 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