windows服务器维护经验小结(rsync,serv_u)

时间:2016-09-25
rsync 客户端执行同步操作的bat


@echo off
rsync -ztruvoglp --progress --password-file=jb51.secrets /cygdrive/g/wwwroot/jb51/ jb51@114.80.*.*::jb51


rsync 服务器端配置

rsyncd.conf

use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#

[bigdown]
path = /cygdrive/f/webroot/bigdown
read only = false
transfer logging = yes
auto user=wtjb51
secrets file=wtjb51.conf


wtjb51.conf(客户端服务器端都要有)
服务器端是根目录,客户端是bin目录,大家多测试下,如果提示密码不对就可能是路径问题

wtjb51:www.jb51.net


rsync守卫进程bat

可以防止机房突然断电,导致rsync服务无法开启

@echo off
for /f "usebackq" %%i in (`"tasklist|find /c "cygrunsrv.exe""`) do (
set chkstat=%%i
)
if %chkstat% == 0 (
del "D:\Program Files\cwRsyncServer\rsyncd.pid" /f
net start RsyncServer
echo ================ >> %date:~0,10%.log
echo %date% %time% check rsync service stop >> rsync%date:~0,10%.log
echo restart rsync service! >> %date:~0,10%.log
echo ================ >> %date:~0,10%.log
)



serv_u守卫进程(针对serv_u经常停止问题)bat


@echo off
for /f "usebackq" %%i in (`"tasklist|find /c "ServUDaemon.exe""`) do (
set chkstat=%%i
)
if %chkstat% == 0 (
net start Serv-U
echo ================ >> %date:~0,10%.log
echo %date% %time% check Serv-U service stop >> %date:~0,10%.log
echo restart Serv-U service! >> %date:~0,10%.log
echo ================ >> %date:~0,10%.log
)


sqlserver定时重启bat


echo y net stop SQLSERVERAGENT
echo y net stop mssqlserver
net start mssqlserver
net start SQLSERVERAGENT


sqlserver压缩日志

可以将jb51.ldf文件变得很小,方便备份数据库等,在sqlserver查询分析器中执行即可。

DUMP TRANSACTION [jb51] WITH NO_LOG
BACKUP LOG [jb51] WITH NO_LOG
DBCC SHRINKDATABASE([jb51])



服务器重启如果使用了rsync服务端,为了不让rsync服务器端无法启动
可以使用下面的bat


net stop RsyncServer
shutdown /r /f


或者在rsync服务端安装目录


del rsyncd.pid
C:\WINDOWS\system32\shutdown.exe /r /f


跟版网原创文章
上一条:windows上面安装squid加速代理网站配置方法 下一条:RSync实现文件同步备份配置详解

相关文章

最新文章