http://ko-lab.net/???荐?/google-app-engine???cron???bot????????絎?茵????????????号??/

??????????????????????????篋冴??腟?罕?????????帥???????????с??Google????ャ?≪?????潟?????????????倶??????????吾??????帥????????

??糸?颷遵????????羂??????????????????障????????

??祉??GAE茯臥???????????鐚?篏?????????????鐚??????????????劫?????

???GAE?????絎?篁ヤ????????純?若?拷???????ゃ?????????????????????????医?????????????

??脂???????ゃ????????緇??????????ц??羆???????????ゃ???区??????с????????????????<????眼??茯臥??????≪???激?с?潟??莎激???????????????????????????????????????????с?????

??祉??????????????????障?с?蚊??????鴻???????????吾?????????????????亥?≧?????????峨????с???????障????障??

???echo???print???var_dump???print_r??у?阪????????????????????????違????????????????障?????

???1????????????????????????2???5???????????????筝?綺??????????с????????с???????????



??肢蚕???????????????????????????障??????????????????????????????????????????障???????????oAuth篏帥?????PHP??鴻???????????????????????????т戎??c???帥?????篋冴??戎??c???帥????????????????

http://ko-lab.net/???荐?/php??х亜????????oauth???twitterapi????≪???祉?鴻?????bot????????????????/


??????

http://d.hatena.ne.jp/deeeki/20091201/gae_register_account

http://d.hatena.ne.jp/deeeki/20091202/gae_cron_deploy



??吾?????篋?@kotobuki_t



鐚?鐚?Google????≪?????潟????????違?ゃ??



鐚?鐚?http://code.google.com/intl/ja/appengine/??????劽????????????鴻?帥?若??????ゃ??????????脂???????????????



鐚?鐚?Welcome to Google App Engine??? ????冴????????????Create an Application?????????????



鐚?鐚?Verify Your Account by SMS???????冴??????障???????阪遣???綽?荀??????????障???????????????????????????

Country and Carrier:??????荐????????障???????????

綏????????????鴻??Japan??????????????勀?眼???????????鴻??紊??????c???ユ?????阪遣????c???≪????吾?鴻?????????????????障?????iPhone?????ゃ?若?≪????ゃ????????c???潟?????????????障??

???昆????阪遣????c???≪????吾????с??????????????


Username:??????荐????????障???????????

Username:???????<?若???≪??????鴻??@?????????????????ゃ?障?????



kotobukilabsample@docomo.ne.jp



??с????????



kotobukilabsample



???Username:?????????障??????????♂???????????????????????羂??????ゃ???????????????????

Send???????????????



??<?若????????????????????????Account code?????ュ??????????????????????

Send???????????????





??<???帥???????????鴻?у?ャ???≪?????潟????с?<?若???≪??????鴻????荐若?????????????????????湿?????????????障????障?????orz

????????????????с??膓????????脂?蚊?????????鴻??膣剛???????????????泣?ゃ?????荀??????????????罐?????????障?????



鐚?鐚?Create an Application???????冴??????у???????????????障???????????



Application Identifier:??????????≪??????宴?若?激?с?潟??ID???荐????????障?????

???bot???????????cron??????????贋・??????????????????????BAN絲乗院????????????????????????????с??????????ID???????障???????????
箴?鐚?

mycharasukisuki



Application Title:??????????≪??????宴?若?激?с?潟???帥?ゃ???????荐????????障?????

???????????障??????????????????????障???????????


筝????????? I accept these terms. ???????с?????????ャ?????Save



鐚?鐚?Application Registered Successfully???????冴??????????????????х?脂?蚊????篋????



鐚?鐚??????冴????荀????Eclipse??????????潟???若???????障?????

http://mergedoc.sourceforge.jp/



篁???????Eclipse 3.5 Galileo??Pleiades All in One ????吾???????????????帥?潟???????????????????????????????



罨<??????若?吾??Щ??????????????????????????????筝?????с????障????????綽?荀??????????

Full All in One (JRE ??????) ?????Java 鐚?綏??????3??ょ?????????Download?????帥?鰹?????????????????????????????????????????潟???若???????障?????



?????<???????<????с???????с??(鐚?卒??鐔?)???600MB綣?????????障?????羂???激??????<?障???????????



???????潟???若?????腟??????c????????篏?罐?????????????????????????В????????障???????????

??障????????zip篏帥????????????荐??????鴻??

http://www.vector.co.jp/soft/win95/util/se169348.html



鐚?鐚?????????????荐??????????????????eclipse???莎桁???????障?????

茹e????????????????????????eclipse??????eclipse.exe???莎桁???????障?????



莎桁???????激??(鐚?卒??鐔?)



??????莎桁???????????若???鴻????若?鴻?祉???潟????c???????冴?????????篏?罐???????????????????荐??????????????????????障????????

??√???????????篋冴???吾???????????????с??????ャ?????OK???

荐????????????篋冴??┃絎???????????с??????ャ?????OK???



?????c????取儀??????????????種室(^o^)鐚?



???貴?????????????翫?????????????????с????<????ャ?若????若??????????????????域????純?????????с?≪???ゃ?潟?鴻????若??…???????????????



??????????冴???????????с?泣?ゃ?????申???????????????????????



??????????????????????宴?若?激?с?潟??http://dl.google.com/eclipse/plugin/3.5???┃絎?????????????????????



篏?罐??莟<??筝???ц┃絎??????????????????????????????鴻????????с?????????ャ????? 罨<??



????????荐?膊???????????障??????у????<?障?????



??ゃ?潟?鴻????若???膣違????冴??????с??罨<??



????ゃ?祉?潟?鴻????????ャ?若????冴??????с??篏睡???>散????♂???????????????障?????????с?????????ャ???????絎?篋?



篏?????????ゃ?潟?鴻????若????紮???障????障???????



Security Warning?????冴????????菴激????????OK?????若????障???????????



???莎桁???????????????c???????????у??莎桁???????障???????????



????????????≪?ゃ?潟?潟??紜???????????????eclipse???┃絎?絎?篋???с?????



鐚?鐚????????????????cron???┃絎?????????障?????

??障???????????鐔?????≪?ゃ?潟?潟????????????????障???????????



????????????冴???????????с??



???????吾?с???????????掩?違?ч???????????????

????????宴?若?後??????????????????????

GoogleWeb?????若????????????篏睡???????????с???????紊??????障???????????



??у??篋??????若????障?????



篁?????????

???????吾?с???????鐚?crontwit

????????宴?若?後??鐚?crontwit

??т??罐?????????????障?????



綏??眼????????吾?с??????祉?????鴻??????若???????????冴??????障??????????

??障??????????????吾?с??????祉?????鴻??????若???????crontwit ??? src ??? crontwit ??? CrontwitServlet.java

???????????障?????

??с??篁ヤ???????潟??????????障?????

package crontwit;
import java.net.MalformedURLException;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class CrontwitServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");

		        try {
		            URL url = new URL("http://your.bot.url/");//???????????吾??紊???????
		            BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
		            String line;

		            while ((line = reader.readLine()) != null) {
		            	resp.getWriter().println(line);
		            }
		            reader.close();

		        } catch (MalformedURLException e) {
		        	resp.getWriter().println("URL faild : " + e);
		        } catch (IOException e) {
		        	resp.getWriter().println("URL faild : " + e);
		        }

	}
}

????????http://your.bot.url/??????????????BOT???URL????吾??????????????????????????
URL url = new URL("http://your.bot.url/");//???????????吾??紊???????

??潟??????????????筝???吾??篆?絖?????????障???????????

?????<?ゃ?? ??? 篆?膊<?с?с????障?????



罨<???????????吾?с??????祉?????鴻??????若???????crontwit ??? war ??? WEB-INF 筝???у劻????????????????

??域?? ??? ?????<?ゃ?????????????????????????????????

?????<?ゃ???????cron.xml???????c????絎?篋?



cron.xml???????????障????????膩??????????????????ч???????障???????????

???????吾?с??????祉?????鴻??????若???????cron.xml????劻??????????????

??≪??????宴?若?激?с?潟??????????? ??? ???????鴻????祉??????c?帥??

??с??膩?????с????????????????????障?????



???????????篁ヤ????潟??????????障?????

<cronentries>
  <cron>
    <url>/crontwit</url>
    <description>cronttwit the run every 2 minutes</description>
    <schedule>every 2 minutes</schedule>
    <timezone>Asia/Tokyo</timezone>
  </cron>
</cronentries>

??????????с??

<schedule>every 2 minutes</schedule>

????医?????紊????????????1?????с??10?????с??????????障?????

???篏?1?????с??1??????篏???с?????



篁??????????????????????ц┃絎???с???????帥???????с?????

every 5 minutes

every 5 minutes

every 12 hours

2nd,third mon,wed,thu of march 17:00

every monday of month 09:00

1st monday of sep,oct,nov 17:00

荅潟???????? http://code.google.com/intl/ja/appengine/docs/java/config/cron.html



篆?絖????????????????с??????????????

????????障?с?с??cron???┃絎??????????????с?????罨<?????cron???絎?茵???с???????????????????篏?罐??с?????



鐚?鐚?鐚?cron???絎?茵???с???????????????????????ゃ????障?????



??????????ゃ??????????????荀?????≪?????????若????????戎???????????????????????????с?????



??障???????茵?罘???????潟?吾?潟?帥?????????≪?ゃ?潟?潟????????????????障??????????? 篏????荐??????????????????翫?????

crontwit does not have an application ID. Click the project settings link below to set it.

????冴???????????с??App Engine project setting?????????????????障?????



?????????????g?脂?≪????冴???????????с????≪??????宴?若?激?с??ID???GAE????脂?蚊???????????┃絎???????Application Identifier???ID?????ュ???????障?????

篁???????crontwit???????障????? OK?????障?????



??<????????┃絎???с?????????????

Enter your Google account email address

???;腓冴???????障????? E??<?若????????鴻???若???????Google????≪?????潟???????ュ???????障?????

Ready to deploy application ‘crontwit’, version 1

???;腓冴?????????????鐚?’ ‘ ???賢荳??????????????????????????鐚???????с????????臀? 筝??????????潟?潟?純?若???脂?≪????????????????障????? ???腟?????????筝?????????

Deployment completed successfully

??????c?????絎?篋???с??鐚?????????с????鴻????轡腮??????篋???с??鐚??????蚊??罕???с?????鐚?



鐚?鐚?鐚?????????????????????∈茯????

https://appengine.google.com/ ????≪???祉?鴻???????

荅峨??????≪??????宴?若?激?с?潟???????????????????

綏????<????ャ?若??Cron jobs????????????????????

Success

??????c?????????????????障?????



鐚?鐚?鐚??????障??



鐚???≪??????宴?若?激?с?潟?с???????ゃ?????cron??????????????障?????



????????鴻??????????? ????????宴?若?娯??????????鴻??篏???????


???????????ュ???????????????篋???с??????????

???????????????????絖????ぇ???絖???с?????????違?????????鐚?箴?鐚?Crontwit2Servlet


??ゃ????c?????CrontwitServlet.java?????絎鴻????潟?????????????

CrontwitServlet??????c?????????????????????鴻???????鐚?箴?鐚?Crontwit2Servlet鐚?????眼?????鐚????????c?帥?????????????????????????????「????????ソ???????


web.xml????????????札筝?????????????吾??????????????????????????申?????????

        <servlet>
		<servlet-name>Crontwit2</servlet-name>
		<servlet-class>crontwit.Crontwit2Servlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>Crontwit2</servlet-name>
		<url-pattern>/crontwit2</url-pattern>
	</servlet-mapping>

cron.xml????????????<cronentries>??????札筝????????????申荐???????

    <cron>
    <url>/crontwit2</url>
    <description>crontwit2 the run every 2 minutes</description>
    <schedule>every 2 minutes</schedule>
    <timezone>Asia/Tokyo</timezone>
  </cron>

??????????ゃ????????

?????蚊??罕???с????????



紊??????????????号????у????????????????????с???????????????障?????





????????????c???????潟?<?潟??罨????@kotobuki_t??