LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to rsync at shutdown (https://www.linuxquestions.org/questions/linux-software-2/how-to-rsync-at-shutdown-565029/)

ikinnu 06-28-2007 01:48 AM

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.

chrism01 06-28-2007 07:33 AM

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.

LightningCrash 06-28-2007 08:03 AM

chrism01 has it right, that's precisely what i would do.

phil.d.g 06-28-2007 08:14 AM

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.


All times are GMT -5. The time now is 07:31 AM.