LoginSignup
0
1

More than 5 years have passed since last update.

AWSでインスタンス起動直後にシェルスクリプトを実行

Posted at

シェルスクリプトを用意

実行したいシェルスクリプト/path/to/target_shell_script.sh

#!/bin/bash
# chkconfig: 2345 98 20
# description: service_name
# processname: service_name

date >> /home/rev84/date.log

んで service に登録

#コピーする場合
sudo cp /path/to/target_shell_script.sh /etc/init.d/service_name
# 直接書く場合
#sudo vim /etc/init.d/service_name

sudo chmod 0755 /etc/init.d/service_name
sudo chkconfig --add service_name
sudo chkconfig service_name on

停止し、起動すると実行される。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1