LinuxQuestions.org
Help answer threads with 0 replies.
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 11-03-2005, 09:55 AM   #1
android6011
Member
 
Registered: May 2005
Posts: 255

Rep: Reputation: 30
startup and shutdown script


I have slackware 10.2 and I have two sql scripts I want to run. One automatically at boot, and one at shutdown. Im not going to go into detail why or anything because it is quite convaluted. All Im asking is how I get the two sql script which are like "mysqldump .... " to run at boot and shutdown. Thanks
 
Old 11-03-2005, 10:04 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,623

Rep: Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890
For boot, put the path to the script at the bottom of : /etc/rc.d/rc.local

For shutdown, put the path to the script at the top of : /etc/rc.d/rc.6

Be sure to give the absolute path in both case, not relative path
 
Old 11-03-2005, 03:41 PM   #3
android6011
Member
 
Registered: May 2005
Posts: 255

Original Poster
Rep: Reputation: 30
you said path to script... I just have the one command I want run so how do I save it as a script I can run?

this is what i want on start "mysql -u root -p pizzass mydb < /folder/rah.sql "

and on shutdown "mysqldump -u root -p pizzass mydb > /folder/rah.sql "

so what shoul I write in those two files just those commands?

Last edited by android6011; 11-03-2005 at 04:12 PM.
 
Old 11-03-2005, 05:04 PM   #4
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
For booting I add things to /etc/rc.d/rc.local.

For shutdown, I solved this issue on my box by first creating /etc/rc.d/rc.shutdown. That way I don't have to tinker with the rc.6 script. Then in /etc/rc.d/rc.6, immediately after PV declares the path variables, I added a call to run rc.shutdown:

#! /bin/sh
#
# rc.6 This file is executed by init when it goes into runlevel
# 0 (halt) or runlevel 6 (reboot). It kills all processes,
# unmounts file systems and then either halts or reboots.

blah, blah, etc. . .

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

# Run the local shutdown procedure.
if [ -x /etc/rc.d/rc.shutdown ]; then
/etc/rc.d/rc.shutdown
fi


# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
. /etc/rc.d/rc.sysvinit
fi

blah, blah, etc. . .

Quote:
you said path to script... I just have the one command I want run so how do I save it as a script I can run?. . .
In my setup, I would do this:

In rc.local:
mysql -u root -p pizzass mydb < /folder/rah.sql

In rc.shutdown:
mysqldump -u root -p pizzass mydb > /folder/rah.sql

I hope this helps.
 
1 members found this post helpful.
  


Reply


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
hanging up on startup / shutdown labworker Linux - Laptop and Netbook 3 01-23-2005 06:56 PM
change startup and shutdown sounds WindowsH8r Linux - Newbie 6 02-17-2004 03:13 PM
dm is ok at startup, but failed during shutdown spyghost Linux - Software 0 09-21-2003 08:29 AM
Startup Items... can I shutdown Stephanie Linux - General 4 08-28-2002 04:51 PM
Startup/Shutdown MasterC Linux - General 13 05-14-2002 05:28 AM

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

All times are GMT -5. The time now is 01:43 PM.

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