Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
su - sleep -c "sleep 60 & echo \$! > /tmp/sleep.pid"
mv /tmp/sleep.pid $1
check process sleep with pidfile /var/run/sleep.pid
start program "/etc/init.d/sleep start" with timeout 60 seconds
stop program "/etc/init.d/sleep stop"
if 5 restarts within 5 cycles then unmonitor
@suz-lab
suz-lab / Initスクリプトのテンプレート.sh
Last active August 29, 2015 14:23
Initスクリプトのテンプレート.sh
#!/bin/sh
#
# chkconfig: - 99 01
. /etc/rc.d/init.d/functions
BASE=`basename $0`
PIDFILE="/var/run/${BASE}.pid"
LOCKFILE="/var/lock/subsys/${BASE}"
mysql -u xxxxxxxx_user -p -h xxx.xxx.xxx.xxx xxxxxxxx < dump.sql
CREATE DATABASE xxxxxxxx DEFAULT CHARACTER SET utf8;
CREATE USER xxxxxxxx_user IDENTIFIED BY 'xxxxxxxx_pass';
GRANT ALL ON xxxxxxxx.* TO xxxxxxxx_user;
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"ProjectName": {
"Type": "String",
"Default": "suzlab"
},
"DbSubnetGroupName": {
"Type": "String",
"Default": "xxxxxxxx"
@suz-lab
suz-lab / MySQLのRDSを作成するCloudFormationのテンプレート.json
Created June 25, 2015 08:13
MySQLのRDSを作成するCloudFormationのテンプレート
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"ProjectName": {
"Type": "String",
"Default": "suzlab"
},
"DbSubnetGroupName": {
"Type": "String",
"Default": "xxxxxxxx"
@suz-lab
suz-lab / 自己証明書を作ってAWS(IAM)にアップロードするコマンド.sh
Last active August 29, 2015 14:23
自己証明書を作ってAWS(IAM)にアップロードするコマンド
openssl req -new -nodes -x509 \
-subj '/C=JP/ST=Tokyo/L=Minato-ku/O=cloudpack/CN=test.xxx' \
-keyout test.key -out test.crt
aws iam upload-server-certificate \
--server-certificate-name test \
--certificate-body file://test.crt \
--private-key file://test.key
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"ProjectName": {
"Type": "String",
"Default": "Cloudpack"
},
"RoleName": {
"Type": "String",
"Default": "Ecs"