LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
LinkBack Search this Thread
Old 06-28-2007, 01:48 AM   #1
ikinnu
Member
 
Registered: Jun 2007
Posts: 64

Rep: Reputation: 15
how to rsync at shutdown


Hi,

I joined this forum only today and was very delighted about that. I am working as a linux admin as a fresher and i have a problem which i couldn't solve. I configured a system such that it will rsync its home directory to another system. I want to run the script at shut down or reboot but it doesn't seem to be working since ssh is being stopped before my script is run. Can anybody give a sol. to my problem? Thanks in advance.
 
Old 06-28-2007, 07:33 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
If only one user eg root is doing shutdown, then you can add your script under the same name, but nearer the start of the $PATH for that user, then it can do it's stuff, then call real shutdown.
Another option (may be confusing to any other potential admin on your box) is to rename the real shutdown to something else and replace it with your script, which then calls real one after rsync is done.
 
Old 06-28-2007, 08:03 AM   #3
LightningCrash
LQ Newbie
 
Registered: Jun 2007
Posts: 23

Rep: Reputation: 15
chrism01 has it right, that's precisely what i would do.
 
Old 06-28-2007, 08:14 AM   #4
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
No, I wouldn't do anything like that.

I would find the appropriate place in the shutdown scripts. For example, in Arch /etc/rc.local.shutdown is one of the first things to be executed in the shutdown procedure and before any daemon is killed. This file is also designed for such things, so this is where I'd put a call to your rsync script.

Of course you didn't state your distribution and more than likely things will be slightly different, so your on your own with that.
 
  


Reply

Tags
rsync+ssh, 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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 12:10 PM
Linux full shutdown vs. manual shutdown? LQtoto Linux - General 9 01-26-2005 06:21 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM
Cannot shutdown computer or kill -9 hung rsync JLindenmuth Linux - General 0 05-05-2004 01:23 PM
konsole shutdown possible? or key combo = shutdown possible? Laptop2250 Linux - Newbie 3 11-16-2003 10:44 AM


All times are GMT -5. The time now is 05:08 PM.

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