LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 12-13-2008, 08:51 AM   #1
rob07mxa
LQ Newbie
 
Registered: Nov 2007
Posts: 19

Rep: Reputation: 0
Placing a backup command in the shutdown process


Hi,

I wrote a script file (based on rsync) to backup data into a usb memory stick. I intend for the backup to occur during shutdown of the system -part of it- , The computer is for home use and switched on daily for different lengths of time. The OS is Fedora 8.

Using cron is not suitable because the machine is not switched on 24/7.

With anacron I couldn't find a way to time the execution of the script just before shutdown when most of changes to the data have happened. in other words, I do not want the backup to happen after (m) minutes delay since switching on of the computer.

The intention is to make the back up part of the normal process of Fedora 8 shutdown i.e. like modified shutdown process.

Therefore, the goal is to insert the command ($ bash backup_script) in one of the files that get executed during system shutdown, so when the user click on switch off button and the process of shutdown begins, the backup command get executed at probably the start of shutdown and when it finishes, the shutdown process carry on as usual.

The question is in which file i should put the command ($ bash backup_script)?


Thanks in anticipation
 
Old 12-13-2008, 09:17 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
you could create a backup script and place it in /etc/rc.d/init.d/ and then link to it in /etc/rc.d/rc0.d/ and /etc/rc.d/rc6.d/ so that it is called before the killall script (S00killall) so it would need to be alphabetically before killall so you could name the link something like S00a_mybackup. Then once the execution of your backup script completes the process will continue with S00killall and then either S01halt or S01reboot. This would likely be a more preferable method vs. sticking it in the halt initscript but if you must place it in the file vs. creating its own then the file you are seeking is /etc/rc.d/init.d/halt.
 
Old 12-14-2008, 12:35 AM   #3
arunmathew1984
Member
 
Registered: Nov 2008
Posts: 31

Rep: Reputation: 15
Quote:
Originally Posted by rayfordj View Post
you could create a backup script and place it in /etc/rc.d/init.d/ and then link to it in /etc/rc.d/rc0.d/ and /etc/rc.d/rc6.d/ so that it is called before the killall script (S00killall) so it would need to be alphabetically before killall so you could name the link something like S00a_mybackup. Then once the execution of your backup script completes the process will continue with S00killall and then either S01halt or S01reboot. This would likely be a more preferable method vs. sticking it in the halt initscript but if you must place it in the file vs. creating its own then the file you are seeking is /etc/rc.d/init.d/halt.
Wow ... I dint know this is how Shutdown worked. And neither did I know you could write custom handles to your shutdown process.

Thanks for the info buddy!


LQ Rocks ...


Linux Archive

Last edited by arunmathew1984; 12-20-2008 at 11:19 AM.
 
Old 12-14-2008, 10:46 AM   #4
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
wow, i did not realize how poorly written my post was...

so... so ... so ... so... so i have no idea what i was thinking when i was writing that but i should definitely have read it for clarity before posting. note to self: anytime you type so use a period instead. sheesh!


Quote:
Originally Posted by arunmathew1984 View Post
Thanks for the info buddy!

LQ Rocks ...
No problem
I'm glad someone found some use from my post even if it was vieing for title of longest runon sentence.
 
  


Reply

Tags
shutdown


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
Autorun Backup script before shutdown!!!!! jp286 Linux - Networking 1 11-25-2008 10:29 AM
backup and recovery process soumalya Linux - Server 3 08-26-2008 11:11 PM
How to remotely shutdown a process darksoul04 Linux - Networking 6 09-11-2005 10:56 PM
shutdown process hanging southpawsc Linux - Newbie 1 09-24-2003 02:08 AM
Backup Process too intense bankrupt Linux - General 1 10-26-2002 10:06 PM


All times are GMT -5. The time now is 05:01 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration