Chinaunix首页 | 论坛 | 博客
  • 博客访问: 484843
  • 博文数量: 279
  • 博客积分: 4467
  • 博客等级: 上校
  • 技术积分: 2830
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-03 14:43
文章分类

全部博文(279)

文章存档

2013年(1)

2012年(39)

2011年(35)

2009年(29)

2008年(131)

2007年(44)

分类:

2007-11-27 16:23:27

Please add lock control for this program as well.
   eg.
   check lock file
   while lock file exist, wait for 15 mins.
   If lock file exist more than 4 hours, overwrite the lock.
   execute sync part and rotation.
   remove lock file.
  
Here are some reference for it:


usage of programe:
     sync_home src_ip local_directory remote_directory number_of_rotation

原始代码:
#!/usr/bin/perl
$result=`ping 192.168.70.13 -c 2`;
if ($result = ~/0% packet loss/)
{
`/bin/rm -rf /home/helen7`;
`/bin/mv /home/helen6 /home/helen7`;
`/bin/mv /home/helen5 /home/helen6`;
`/bin/mv /home/helen4 /home/helen5`;
`/bin/mv /home/helen3 /home/helen4`;
`/bin/mv /home/helen2 /home/helen3`;
`/bin/mv /home/helen1 /home/helen2`;
`/bin/mv /home/helen /home/helen1`;
`/usr/bin/rsync -a /home/helen_tmp/ /home/helen/`;
`/usr/bin/rsync -azv --one-file-system 192.168.70.13:/home/helen/ /home/helen_tmp/ | mail -s "Helen Notebook backup done" `;
}

sync_home:


#!/usr/bin/perl

$result=`ping 192.168.70.13 -c 2`;
if ($result = ~/0% packet loss/)
{
`/bin/rm -rf /home/helen7`;
`/bin/mv /home/helen6 /home/helen7`;
`/bin/mv /home/helen5 /home/helen6`;
`/bin/mv /home/helen4 /home/helen5`;
`/bin/mv /home/helen3 /home/helen4`;
`/bin/mv /home/helen2 /home/helen3`;
`/bin/mv /home/helen1 /home/helen2`;
`/bin/mv /home/helen /home/helen1`;
`/usr/bin/rsync -a /home/helen_tmp/ /home/helen/`;
`/usr/bin/rsync -azv --one-file-system 192.168.70.13:/home/helen/ /home/helen_tmp/ | mail -s "Helen Notebook backup done" op@uniforce.net`;
}

阅读(329) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~