2008年12月4日

CentOS5 使用VNC server

請安裝 vnc 跟 vnc-server 這兩個套件

# yum install vnc
# yum install vnc-server

編輯 /etc/sysconfig/vncservers,
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
其中2,是port的最後一個數字, 如 5801, myusername指預設vnc登入的身份
請修改為預設root登入
VNCSERVERS="1:root"

設定登入的密碼
# vncpasswd
Password:
Verify:

# vi ~/.vnc/xstartup
解除註解以下兩行
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

重新啟動 VNC Server
# service vncserver restart
設定開機時啟動vncserver
#chkconfig vncserver on

# chkconfig --list | grep vncserver
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off

# netstat -lt
你可以看到以下就表示 vnc server 已經啟動了,它監聽5801, 所以要注意防火牆要打開
tcp 0 0 *:5801

使用VNC client或者在有安裝JAVA的瀏覽器連線即可

Windows Server 2003備份bat檔

Windows Server 2003備份bat檔
最近需要在windows server 2003將所備份的檔案copy到網路磁碟NAS上然後加上星期予以區隔。
在網路爬了些文章,終於寫好了。以下就僅供記錄參考了。

set wk=%date:~10,15%
if %wk%==星期一 goto mon
if %wk%==星期二 goto tue
if %wk%==星期三 goto wed
if %wk%==星期四 goto thu
if %wk%==星期五 goto fri
if %wk%==星期六 goto sat
if %wk%==星期日 goto sun

:mon
copy d:\backup\backfile.txt Y:\backfile_mon.txt
goto finish

:tue
copy d:\backup\backfile.txt Y:\backfile_tue.txt
goto finish

:wed
copy d:\backup\backfile.txt Y:\backfile_wed.txt
goto finish

:thu
copy d:\backup\backfile.txt Y:\backfile_thu.txt
goto finish

:fri
copy d:\backup\backfile.txt Y:\backfile_fri.txt
goto finish

:sat
copy d:\backup\backfile.txt Y:\backfile_sat.txt
goto finish

:sun
copy d:\backup\backfile.txt Y:\backfile_sun.txt

:finish
pause