root権限で
1.起動スクリプトの作成
# vi /etc/init.d/red5 でブランクファイルを開いて以下の内容で作成、保存
#! /bin/sh
#
# Author: Jake Hilton <red5@jakehilton.com>
# /etc/init.d/red5
#
# Check for missing file
RED5_DIR=/opt/red5
test -x $RED5_DIR/red5.sh || exit 5
case "$1" in
start)
echo -n "Starting Red5 Service"
echo -n ""
cd $RED5_DIR
su -s /bin/bash -c "$RED5_DIR/red5.sh &" red5
sleep 2
;;
stop)
echo -n "Shutting down red5"
echo -n ""
su -s /bin/bash -c "killall -q -u red5 java" red5
sleep 2
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
;;
esac
2.実行権限の寄与
# chmod 755 /etc/ini.d/red5
3.自動起動登録
# chkconfig --add red5
Ubuntuの場合、chkconfigによる自動起動登録ではなく、「sysv-rc-conf」コマンドを使います。
$ sudo apt-get update
$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf --level 2345 red5 on