有鑑於緊急救護勤務與日俱增,且民眾對公務員服務品質之需求亦相對提高,為考核該局各勤分隊同仁執行緊急救護之情形,藉以強化緊急救護技術執勤技能,提升緊急醫療救護品質,健全到院前緊急救護服務功能,提高患者存活機率,特辦理救護評比作業。
考核項目
(一)業務檢查:救護車5項簿冊之填寫記錄、救護記錄表填寫與案件登錄情形、大量傷病患兵棋推演情形、救護滿意度調查、救護事蹟剪報與救護案例檢討及轄區救護資源通訊聯繫建置、救護宣導成果等。
(二)實地抽查:救護車外觀、內部急救器材執行消毒情形、耗材儲存、保管、數量、擺放功能等,訓練器材是否清潔勘用。
(三)情境抽測:由訓練教官於各分隊備勤人員中隨機抽測救護情境與單項技術、個人救護服裝儀容、應勤裝備、備勤狀況、出勤時間、無線電回報等。
2011年1月27日 星期四
2010年11月2日 星期二
消防三等特考 應考科目
| ||||||||
98年、99年公務人員特種考試警察人員考試消防類科錄取人員配賦表
| 98年、99年公務人員特種考試警察人員考試消防類科錄取人員配賦表 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 一、 依公務人員特種考試警察人員考試規則第7條及內政部辦理公務人員特種考試警察人員考試消防警察人員類科錄取人員分配實務訓練作業注意事項第2點規定:是類考試錄取人員由內政部先行分發本署,嗣由本署依其在校成績作業分至各消防機關,先予敘明。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 二、 歷年分發作業,均係以在校成績名次先後,依序辦理選填志願分發;考量各教授班評分標準不一,其成績排序,係以人數最少之教授班為基準,按人數差額平均值,穿插辦理,以同時開始,同時結束為原則。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 三、 檢附「警察特考錄取人員配賦分發表」1份。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 備註: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 一、99年公務人員特種考試警察人員考試錄取人員將於99年10月29日報到;98年公務人員特種考試警察人員考試錄取人員預計於100年1月21日報到,請控留備缺,俾利分發作業。如因故未能全數備缺接受分發者,請依99年4月28日「研商消防人力成長暨99-100年隊員分發配賦及定期請調作業原則會議」結論及本部99年6月11日內授消字第0990823074號函示辦理。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 二、98年公務人員特種考試警察人員考試錄取人員係以99年9月底於警專接受教育訓練之一般生人數配賦分發,屆時如有中途退訓、訓練不合格或經各消防機關,自行協調其他縣市消防機關同意移列分發者,再按實際狀況調整,屆時未足額分發缺額,全數移併100年10月警察特考分發員額數優先分發。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 三、臺北縣及臺中、臺南、高雄等三縣、市將於99年12月25日升格改制,98年警察特考一般生配賦員額及100年度未足額分發缺額,將以縣、市合併計算方式配賦分發改制後新北市、臺中市、臺南市、高雄市消防局。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
各地勤務中心台台呼
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2010年8月11日 星期三
仁愛分隊的實習生活-安檢業務
2010年8月6日 星期五
仁愛分隊的實習生活-補蜂(火攻)
2010年7月30日 星期五
仁愛分隊的實習生活-義消訓練
2010年7月29日 星期四
仁愛分隊的實習生活-搶救訓練
仁愛分隊的實習生活-救護訓練
2010年4月22日 星期四
TPC - Fireman養成訓練
2010年1月26日 星期二
Jan-7th ~ Jan-8th 清境之旅行程規劃
路線總覽
清靜農場地圖
行車規劃
國道一號→彰化系統交流道(192K)→轉國道三號南下→霧峰系統交流道(214K)→國道六號起點→東草屯交流道→愛蘭交流道→埔里交流道→埔里端出口(國六終點)→轉台14→霧社(轉台14甲)→清境農場
Day 1
06:00 出發 (Keelung) - 早餐 仁一路飯糰
10:00 埔里酒廠 or 紙教堂
12:00 遊客中心午餐
12:30 小瑞士花園 or 青青草原
15:00 飯店 Check-in (名人渡假村)
18:00 晚餐 - 清境美斯樂擺夷料理傣味餐廳
早睡早起
清境名人渡假村(台14甲線11公里處) Tel:049-2803668
清境美斯樂擺夷料理傣味餐廳 (南投縣仁愛鄉大同村博望巷27號) Tel: 049-2803908
Day 2
05:40 武嶺 日出及雲海
08:00 飯店早餐 小歇
10:50 Check-out
11:40 埔里市區午餐
午餐選項:
阿菊肉圓 (南投縣埔里鎮西安路一段33號) 下山後走中山路一段、二段、右轉中正路、緊接地一個路口左轉西安路,往前一小段即達。
CHUC MUNG NAM MOI 越南河粉 (南投縣埔里鎮忠孝一路) 下山後走中山路一段、二段、左轉中華路、注意橫向道路,會先經過忠孝一路,緊接著右轉忠孝二路,即達。
晚餐:
北返吃尾牙摟!!
2009年11月24日 星期二
Avoid Deprecated: Assigning the return value of new by reference is deprecated in...
Preventing Warning Message from Cakephp
Message: Deprecated: Assigning the return value of new by reference is deprecated in...
Solution: Modify cake/libs/configure.php
< ?php
if (isset($config['debug'])) {
if ($_this->debug) {
error_reporting(E_ALL);
// add below contents
if (error_reporting() > 6143) {
error_reporting(E_ALL & ~E_DEPRECATED);
}
?>
Message: Deprecated: Assigning the return value of new by reference is deprecated in...
Solution: Modify cake/libs/configure.php
< ?php
if (isset($config['debug'])) {
if ($_this->debug) {
error_reporting(E_ALL);
// add below contents
if (error_reporting() > 6143) {
error_reporting(E_ALL & ~E_DEPRECATED);
}
?>
2009年11月19日 星期四
Capture http package for your http server
tcpdump -A -s 1024 'port 80 and src host 192.x.x.x'
-A enables ASCII mode display
-s enlarge package length
src host x.x.x.x for specified host IP only
-A enables ASCII mode display
-s enlarge package length
src host x.x.x.x for specified host IP only
Enables your Dreamweaver to recognize thtml and ctp
1. Modify C:\Documents and Settings\user_name\Application Data\Macromedia\Dreamweaver 8\Configuration\Extensions.txt
Append thtml, ctp in below section:
“PHP,PHP3,PHP4,PHP5,TPL,THTML,CTP:PHP Files”
2. Modify C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Extensions.txt
Append thtml, ctp in below section:
“PHP,PHP3,PHP4,PHP5,TPL,THTML,CTP:PHP Files”
2. Modify C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Extensions.txt
Append thtml, ctp in below section:
“PHP,PHP3,PHP4,PHP5,TPL,THTML,CTP:PHP Files”
3. Modify C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes directory\MMDocumentTypes.xml
3. Modify C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes directory\MMDocumentTypes.xml
Append thtml, ctp in below section:
< documenttype id="PHP_MySQL" writebyteordermark="false" file="Default.php" macfileextension="php,php3,php4,php5,thtml,ctp" winfileextension="php,php3,php4,php5,thtml,ctp" internaltype="Dynamic" servermodel="PHP MySQL" >
2009年10月6日 星期二
My notes of jquery-translate usage
Effects:
Automatic distinguish between Simp Chinese and Trad Chinese then translate to desired language. Few steps to enable localization functionality.
Requirement:
#1. jquery Library. get from here.
#2. jquery-translate. get from here.
Procedures:
#1. Include all necessary JS file.
#2. Make sure all require JS file store in inc folder correctly.
#3. Content of wraper.trans.js
var lang = window.navigator.userLanguage || window.navigator.language ;
var autolang=lang.toLowerCase();
var trans2CN = (autolang == "zh-cn") ? true : false;
trans2CN = true;
$(document).ready(function() {
if(trans2CN){
document.navagation.src='/images/pic.gif';
$('body').translate('zh-CN');
}
});
Requirement:
#1. jquery Library. get from here.
#2. jquery-translate. get from here.
Procedures:
#1. Include all necessary JS file.
#2. Make sure all require JS file store in inc folder correctly.
#3. Content of wraper.trans.js
var lang = window.navigator.userLanguage || window.navigator.language ;
var autolang=lang.toLowerCase();
var trans2CN = (autolang == "zh-cn") ? true : false;
trans2CN = true;
$(document).ready(function() {
if(trans2CN){
document.navagation.src='/images/pic.gif';
$('body').translate('zh-CN');
}
});
2009年9月25日 星期五
How to resolve "無法啟動 adobe updater"
1. Browse to C:\DocumentsandSettings\User Name\ApplicationData\Adobe\Updater\
2. Create a new file or Modify exist file named "AdobeUpdaterPrefs.dat"
3. Paste below content and save the document.
<?xml version="1.0" encoding="UTF-8" ?>
<AdobeUpdater>
<AutoCheck>0</AutoCheck>
</AdobeUpdater>
4. Launch Adobe Photoshop to test.
2. Create a new file or Modify exist file named "AdobeUpdaterPrefs.dat"
3. Paste below content and save the document.
<?xml version="1.0" encoding="UTF-8" ?>
<AdobeUpdater>
<AutoCheck>0</AutoCheck>
</AdobeUpdater>
4. Launch Adobe Photoshop to test.
2009年8月26日 星期三
MSN 2009 for Windows 2003, 2008 0x80280004 (原來一切都是Wrapper搞的鬼)
如果作業系統是Windows 2003, Windows 2008當安裝MSN的時候,得到回應 os_check: 0x80280004,嘗試下列方式安裝。
MSN2009這各版本微軟還是將Os type determination 直接封裝在wlsetup-web.exe裡面,要成功安裝這各版本,除了取得 Messenger.msi 外,包含相關的XML parser、Dll以及其他MSN附屬程式,都得一併安裝,才能保證MSN個功能正常運作。
安裝方式:
Step1:
找一台XP或能成功安裝MSN2009的機器,下載 MSN 安裝程式wlsetup-web.exe http://download.live.com/messenger 。
Step2:
執行 wlsetup-web.exe 之後,依照畫面提示將MSN安裝完成。
Step3:
安裝完成後,請到 C:\Program Files\Common Files\Windows Live\.cache 這個目錄,MSN2009的相關暫存檔案都放在此,請將所有的*.MSI檔案複製到Windows2003 or 2008進行安裝。
Step4:
至此,所有的程式若已安裝完成,可以開始使用MSN。
如果有遇到 Error 80040111 or 80040154,再額外進行Step5。
Step5:
Dos Prompt下執行 %windir%\system32\regsvr32 %windir%\system32\msxml3.dll
到微軟網站下載XML parser。 http://www.microsoft.com/downloads/details.aspx?familyid=28494391-052b-42ff-9674-f752bdca9582&displaylang=en
安裝。
註記: 倘若依照上述方式進行安裝之後,還是無法成功登入,請查看相關錯誤代碼的解決方式 或來信討論。
2008年8月12日 星期二
Programming for Administration
概述:原本考慮使用現有的商業套件(teleport)來進行工作上每日要進行的查詢及登載作業,但受訪的頁面需要登錄,Cookies,並透過sessionID持續進行各頁面的存取,無奈對商業軟體不熟悉不知如何設定,只好消滅自己的腦細胞,來製作相關的程式碼。
方式:透過Perl包裹wget,將每日繁瑣的數據儲存作業儲存在特定主機,並使用cron job來定期驅動本程式。
#!/usr/bin/perl
#
# webcatcher.pl
#
# $Id: webcatcher.pl,v 1.1 2008/08/12 08:24:28 kent Exp $
#
# This script is used to claw web pages. During the execution period
# it will try to wrap wget as the grabber. It can help you to grab
# web pages regluarly and send notification email to the appropriate
# person. You are able to modify it under the same terms as Perl.
#
#
# Copyright(C)2008 Kent Hsu
#
#
use strict;
use Getopt::Std;
use XML::Simple;
use Mail::Sender;
###################
# ENV definition #
###################
my $module_name = 'webcatcher.pl';
my $config_name = 'webcatcher.xml';
my $wget_command = (`which wget`);
my $file_home_dir = `pwd`;
my $base_url = undef;
my $date_now = undef;
###################
#String definition#
###################
my $help;
my $wget_not_exist;
my $wget_failed;
my $config_file_not_exist;
my $vars_name_null = undef;
my $vars_undef = undef;
my $xml_parse_failed = undef;
my $xml_null = undef;
my $base_url_empty = undef;
my $no_server_exist = undef;
my $message_subject = undef;
my $message_body = undef;
my $done = undef;
####################
# member variables #
####################
my $full_xml = undef;
my @servers = ();
my $notify_ref = undef;
my $server_ref = undef;
my %server_detail = ();
&init_string; #ini strings
MAIN:{
&parse_args;
&parse_from_xml;
&main_proc;
&send_notification;
print $done;
} #End of MAIN:
sub parse_args {
use vars qw/ %opt /;
getopts( "hevf:", \%opt ) or die $help;;
if ($opt{e}){
#nothing need to be proceed here....
} elsif ($opt{f}){
$config_name = $opt{f};
} elsif ($opt{v}){
&show_parsed_xml;
die $done;
} elsif ($opt{h}){
die $help;
} else {
die $help;
}
}
sub main_proc {
foreach (@servers){
%server_detail = %{$server_ref->{$_}};
my $params = ' -nH -nd --no-check-certificate ';
my $today = &get_date;
$params .= "-P" . $server_detail{save_at} . "/$today";
if ( $server_detail{deeplyclaw} eq "true" ){
$params .= " -r -l 0 ";
} else {
$params .= " -p ";
}
if ( $server_detail{usepassword} eq "true" ){
$params .= ' --http-user=' . $server_detail{userid} . ' --http-passwd=' . $server_detail{password} ;
}
my @url = $server_detail{url}{item};
my $cookie_initd = 'false';
my $cookie_string = '';
foreach my $urlitem (@url){
if( ref($urlitem) eq 'ARRAY' ){
foreach (@$urlitem){
if ( $server_detail{usecookie} eq "true" ){
if ($cookie_initd eq "false") {
$cookie_string = " --cookies=on --keep-session-cookies --save-cookies=cookie.txt ";
$cookie_initd = "true";
} else {
$cookie_string = " --referer=" . %{@$urlitem[0]}->{value} . " --cookies=on --keep-session-cookies --load-cookies=cookie.txt ";
}
}
#print "parms=" . $params . $cookie_string . "--post-data '" . %{$_}->{postdata} . "' " . %{$_}->{value} . "\n\n";
my $tmpParams = $params . $cookie_string;
if (%{$_}->{postdata}){
$tmpParams .= "--post-data '" . %{$_}->{postdata} . "' ";
}
&exec_wget($tmpParams , %{$_}->{value});
}
} else {
&exec_wget($params , $server_detail{url}{item});
}
}#End of foreach(@url)
$message_body .= "
\n";
} #End of foreach (@servers)
#print $message_body;
}
sub exec_wget {
my ($args, $url) = @_;
chomp $wget_command;
if ( ! -f $wget_command ){
die $wget_not_exist;
}
my $cmd_line = " " . $args . " " . $url;
WGET:{
my $cmd = `$wget_command $cmd_line`;
print $cmd . "\n";
}
}
sub parse_from_xml {
unless( -f $config_name ){
die $config_name . $config_file_not_exist;
}
$full_xml = XMLin($config_name);
unless ($full_xml){
die $xml_null;
}
$base_url = %$full_xml->{base_url};
unless ($base_url){
die $base_url_empty;
}
$notify_ref = %$full_xml->{notification};
$server_ref = %$full_xml->{server};
@servers = sort keys(%$server_ref);
unless (@servers){
die $no_server_exist;
}
foreach (@servers){
my @all_models = qw(save_at requirehttps usepassword userid password usecookie url);
validate_field( \@all_models, \%{$server_ref->{$_}} );
}
}
sub send_notification {
eval {
(new Mail::Sender)
->OpenMultipart({
smtp => "$notify_ref->{smtp_server}",
from => "$notify_ref->{mail_from}",
to => "$notify_ref->{rcpt_to}",
subject => "$message_subject . $date_now",
#debug => 'c:\temp\zkMailFlow.log',
multipart => 'mixed',
})
->Part({ctype => 'multipart/alternative'})
->Part({ctype => 'text/html', disposition => 'NONE', msg => $message_body})
->EndPart("multipart/alternative")
->Close();
} or print "Error sending mail: $Mail::Sender::Error\n";
}
sub get_date {
my @date = (localtime) [5,4,3];
$date[0] += 1900;
$date[1] += 1;
$date_now = sprintf "%4d-%02d-%02d", @date;
return $date_now;
}
sub show_parsed_xml {
if( ! -f $config_name ){
die $config_name . $config_file_not_exist;
}
$full_xml = XMLin($config_name);
use Data::Dumper;
print Dumper($full_xml);
}
sub validate_field (\@\%){
my ($vars_keys, $vars_hash) = @_;
foreach (@$vars_keys){
if(exists $vars_hash->{$_}) {
if( ! defined $vars_hash->{$_} || $vars_hash->{$_} eq "" ) {
die "'". $_ . "' " . $vars_undef . $xml_parse_failed . "\n";
}
} else {
die "'" . $_ . "' " . $vars_name_null . $xml_parse_failed . "\n";
}
}
}
###################
#String defination#
###################
sub init_string {
$vars_name_null = <
must be specifyed please check your configuration file.
EOM
$vars_undef = <
can not be null, please correct your $config_name files.
EOM
$config_file_not_exist = <
is not exist please create it first.
EOM
$xml_null = <
XML file can not be null, parsing falied!
EOM
$base_url_empty = <
base_url can not be null, please check your configuration file - $config_name.
EOM
$no_server_exist = <
No servers need to be parsed.!
EOM
$xml_parse_failed = <
XML parsing falied!
EOM
$wget_not_exist = <
wget is not exist please install it first.
EOM
$wget_failed = <
wget failed to execute please follow the default XML configuration setting.
EOM
$message_subject = '@trip service MRTG Report';
$message_body = <
Dear all,
Below is the RTG Report for a-trip Service:
EOM
$done = <
Done...
EOM
$help = <
usage: $module_name / $module_name [options] filename
Standard $module_name options:
-e execute : executing with default configuration file.
(with this other arguments will be ignored.)
-f filename : specifying configuration file to be parsed
(The default configuration is named to webcatcher.xml, with
this paramater to alternatively specify the configuration file.)
-v view XML : viewing default XML content
-h help : dumpping help message
EOM
}
方式:透過Perl包裹wget,將每日繁瑣的數據儲存作業儲存在特定主機,並使用cron job來定期驅動本程式。
#!/usr/bin/perl
#
# webcatcher.pl
#
# $Id: webcatcher.pl,v 1.1 2008/08/12 08:24:28 kent Exp $
#
# This script is used to claw web pages. During the execution period
# it will try to wrap wget as the grabber. It can help you to grab
# web pages regluarly and send notification email to the appropriate
# person. You are able to modify it under the same terms as Perl.
#
#
# Copyright(C)2008 Kent Hsu
#
#
use strict;
use Getopt::Std;
use XML::Simple;
use Mail::Sender;
###################
# ENV definition #
###################
my $module_name = 'webcatcher.pl';
my $config_name = 'webcatcher.xml';
my $wget_command = (`which wget`);
my $file_home_dir = `pwd`;
my $base_url = undef;
my $date_now = undef;
###################
#String definition#
###################
my $help;
my $wget_not_exist;
my $wget_failed;
my $config_file_not_exist;
my $vars_name_null = undef;
my $vars_undef = undef;
my $xml_parse_failed = undef;
my $xml_null = undef;
my $base_url_empty = undef;
my $no_server_exist = undef;
my $message_subject = undef;
my $message_body = undef;
my $done = undef;
####################
# member variables #
####################
my $full_xml = undef;
my @servers = ();
my $notify_ref = undef;
my $server_ref = undef;
my %server_detail = ();
&init_string; #ini strings
MAIN:{
&parse_args;
&parse_from_xml;
&main_proc;
&send_notification;
print $done;
} #End of MAIN:
sub parse_args {
use vars qw/ %opt /;
getopts( "hevf:", \%opt ) or die $help;;
if ($opt{e}){
#nothing need to be proceed here....
} elsif ($opt{f}){
$config_name = $opt{f};
} elsif ($opt{v}){
&show_parsed_xml;
die $done;
} elsif ($opt{h}){
die $help;
} else {
die $help;
}
}
sub main_proc {
foreach (@servers){
%server_detail = %{$server_ref->{$_}};
my $params = ' -nH -nd --no-check-certificate ';
my $today = &get_date;
$params .= "-P" . $server_detail{save_at} . "/$today";
if ( $server_detail{deeplyclaw} eq "true" ){
$params .= " -r -l 0 ";
} else {
$params .= " -p ";
}
if ( $server_detail{usepassword} eq "true" ){
$params .= ' --http-user=' . $server_detail{userid} . ' --http-passwd=' . $server_detail{password} ;
}
my @url = $server_detail{url}{item};
my $cookie_initd = 'false';
my $cookie_string = '';
foreach my $urlitem (@url){
if( ref($urlitem) eq 'ARRAY' ){
foreach (@$urlitem){
if ( $server_detail{usecookie} eq "true" ){
if ($cookie_initd eq "false") {
$cookie_string = " --cookies=on --keep-session-cookies --save-cookies=cookie.txt ";
$cookie_initd = "true";
} else {
$cookie_string = " --referer=" . %{@$urlitem[0]}->{value} . " --cookies=on --keep-session-cookies --load-cookies=cookie.txt ";
}
}
#print "parms=" . $params . $cookie_string . "--post-data '" . %{$_}->{postdata} . "' " . %{$_}->{value} . "\n\n";
my $tmpParams = $params . $cookie_string;
if (%{$_}->{postdata}){
$tmpParams .= "--post-data '" . %{$_}->{postdata} . "' ";
}
&exec_wget($tmpParams , %{$_}->{value});
}
} else {
&exec_wget($params , $server_detail{url}{item});
}
}#End of foreach(@url)
$message_body .= "
$_
Click me to view MRTG Graphy.\n";
} #End of foreach (@servers)
#print $message_body;
}
sub exec_wget {
my ($args, $url) = @_;
chomp $wget_command;
if ( ! -f $wget_command ){
die $wget_not_exist;
}
my $cmd_line = " " . $args . " " . $url;
WGET:{
my $cmd = `$wget_command $cmd_line`;
print $cmd . "\n";
}
}
sub parse_from_xml {
unless( -f $config_name ){
die $config_name . $config_file_not_exist;
}
$full_xml = XMLin($config_name);
unless ($full_xml){
die $xml_null;
}
$base_url = %$full_xml->{base_url};
unless ($base_url){
die $base_url_empty;
}
$notify_ref = %$full_xml->{notification};
$server_ref = %$full_xml->{server};
@servers = sort keys(%$server_ref);
unless (@servers){
die $no_server_exist;
}
foreach (@servers){
my @all_models = qw(save_at requirehttps usepassword userid password usecookie url);
validate_field( \@all_models, \%{$server_ref->{$_}} );
}
}
sub send_notification {
eval {
(new Mail::Sender)
->OpenMultipart({
smtp => "$notify_ref->{smtp_server}",
from => "$notify_ref->{mail_from}",
to => "$notify_ref->{rcpt_to}",
subject => "$message_subject . $date_now",
#debug => 'c:\temp\zkMailFlow.log',
multipart => 'mixed',
})
->Part({ctype => 'multipart/alternative'})
->Part({ctype => 'text/html', disposition => 'NONE', msg => $message_body})
->EndPart("multipart/alternative")
->Close();
} or print "Error sending mail: $Mail::Sender::Error\n";
}
sub get_date {
my @date = (localtime) [5,4,3];
$date[0] += 1900;
$date[1] += 1;
$date_now = sprintf "%4d-%02d-%02d", @date;
return $date_now;
}
sub show_parsed_xml {
if( ! -f $config_name ){
die $config_name . $config_file_not_exist;
}
$full_xml = XMLin($config_name);
use Data::Dumper;
print Dumper($full_xml);
}
sub validate_field (\@\%){
my ($vars_keys, $vars_hash) = @_;
foreach (@$vars_keys){
if(exists $vars_hash->{$_}) {
if( ! defined $vars_hash->{$_} || $vars_hash->{$_} eq "" ) {
die "'". $_ . "' " . $vars_undef . $xml_parse_failed . "\n";
}
} else {
die "'" . $_ . "' " . $vars_name_null . $xml_parse_failed . "\n";
}
}
}
###################
#String defination#
###################
sub init_string {
$vars_name_null = <
must be specifyed please check your configuration file.
EOM
$vars_undef = <
can not be null, please correct your $config_name files.
EOM
$config_file_not_exist = <
is not exist please create it first.
EOM
$xml_null = <
XML file can not be null, parsing falied!
EOM
$base_url_empty = <
base_url can not be null, please check your configuration file - $config_name.
EOM
$no_server_exist = <
No servers need to be parsed.!
EOM
$xml_parse_failed = <
XML parsing falied!
EOM
$wget_not_exist = <
wget is not exist please install it first.
EOM
$wget_failed = <
wget failed to execute please follow the default XML configuration setting.
EOM
$message_subject = '@trip service MRTG Report';
$message_body = <
Dear all,
Below is the RTG Report for a-trip Service:
EOM
$done = <
Done...
EOM
$help = <
usage: $module_name / $module_name [options] filename
Standard $module_name options:
-e execute : executing with default configuration file.
(with this other arguments will be ignored.)
-f filename : specifying configuration file to be parsed
(The default configuration is named to webcatcher.xml, with
this paramater to alternatively specify the configuration file.)
-v view XML : viewing default XML content
-h help : dumpping help message
EOM
}
訂閱:
文章 (Atom)











