Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


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

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
mv -f

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
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: 46
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
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
Senior Member
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,194

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/
rm /etc/dhcpc/

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
LQ Guru
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 62
How about it this way.
create script like this called /etc/rc.d/init.d/dhcp_cleanup
mv -f /etc/dhcpc/dhcpcd-eth0.cache /etc/dhcpc/dhcpcd-eth0.cache.bak
mv -f /etc/dhcpc/ /etc/dhcpc/
mv -f /etc/dhcpc/ /etc/dhcpc/
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.

" Google the Linux way @ "

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:42 PM.

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