This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
SORRY_INSTANCE=`curl -s http://169.254.169.254/latest/meta-data/instance-id` | |
ELB_NAME=elbfailover | |
SLEEPTIME=2 | |
while :; do | |
TIMESTAMP=`date -u +"%Y-%m-%dT%H:%M:%SZ"` | |
ELB_STATUS=`aws elb describe-instance-health --load-balancer-name $ELB_NAME` | |
HEALTHY_HOST_COUNT=`echo $ELB_STATUS | jq "[ .InstanceStates[] | select(.InstanceId != \"$SORRY_INSTANCE\" and .State == \"InService\") ] | length"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class QueueWorker { | |
private static final String QUEUE_URL="..."; | |
public static void main(String[] args) { | |
QueueWorker main = new QueueWorker(); | |
ClasspathPropertiesFileCredentialsProvider provider = new ClasspathPropertiesFileCredentialsProvider("aws.properties"); | |
AmazonSQSClient amazonSQSClient = new AmazonSQSClient(provider); | |
main.sqs = amazonSQSClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class QueueWorker2 { | |
private static final String QUEUE_URL="..."; | |
public static void main(String[] args) { | |
try (ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml")) { | |
SpringQueueWorker main = context.getBean(SpringQueueWorker.class); | |
main.sqs = context.getBean(AmazonSQS.class); | |
main.mailSender = context.getBean(MailSender.class); | |
main.mailTemplate = context.getBean(SimpleMailMessage.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | |
<bean id="worker" class="jp.classmethod.sample.spring.start.SpringQueueWorker" /> | |
<bean id="amazonSQSClient" class="com.amazonaws.services.sqs.AmazonSQSClient"> | |
<constructor-arg> | |
<bean class="com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#reference | |
http://www.mastertheboss.com/jboss-script/twiddle-reference-guide | |
#clear exception count | |
#restart | |
twiddle.sh -s XX.XX.XX.XX:XXXX invoke "SA-Schedulers:class=jp.ossc.tstruts2.service.scheduler.SchedulerService,name=SaBunsanBatchSeigyoFuncSchedulerService**" restart | |
#stop | |
twiddle.sh -s XX.XX.XX.XX:XXXX invoke "SA-Schedulers:class=jp.ossc.tstruts2.service.scheduler.SchedulerService,name=SaBunsanBatShoriErrCheckFuncSchedulerService**" stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wget http://s3.amazonaws.com/rds-downloads/RDSCli.zip | |
$unzip RDSCli.zip | |
$export AWS_RDS_HOME=/home/ec2-user/RDSCli-1.13.002 | |
$export PATH=$PATH:$AWS_RDS_HOME/bin | |
$export EC2_REGION=ap-northeast-1 | |
$vi cred.txt | |
# Enter the AWS Keys without the < or > | |
# These can be found at http://aws.amazon.com under Account->Security Credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(1337); | |
console.log('Server is running'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.write("Hello\n"); | |
setTimeout(function(){ | |
res.end('This is the Node World !!!!\n'); | |
}, 10000); | |
}).listen(1337); | |
console.log('Server running'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.paths.push('/usr/local/lib/node_modules'); | |
var server = require('http').createServer(function(req, res){ | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.end('server connected'); | |
}); | |
server.listen(1337); | |
var io = require('socket.io').listen(server); | |
io.sockets.on('connection', function (socket) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<script src="http://xxx.xxx.xxx.xxx:1337/socket.io/socket.io.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
var socket = io.connect('http://xxx.xxx.xxx.xxx:1337/'); | |
socket.on('connect', function() { |