1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

drone.ioをstart-stop-daemonを使って起動制御した

Last updated at Posted at 2016-02-02

備忘のためにメモを残します。
debパッケージとか使えば、こういうの書かなくてよかったかなー、と思いつつstart-stop-daemon書いたことなかったのと、こういうちまちましたのが好きなので用意しました。

droneは、GitHubのcommitリビジョン[462a44d0cf4c59e3bc01255d9a2a1d8b2c4bf33f]でビルドしました。

/etc/init.d/drone.sh

# !/bin/bash

source /etc/profile.d/drone.sh
source /root/.bashrc
export GIN_MODE=release

PID=/var/run/drone.pid
NAME=drone
DRONE_HOME=${droneをソースコードからビルドした場所}

case "$1" in
  start)
    echo "starting $NAME";
    start-stop-daemon --start --background --exec $DRONE_HOME/drone  --make-pidfile --pidfile "$PID"
    echo "$NAME was successfully started!"
    ;;
  stop)
    echo "stopping " "$NAME"
    start-stop-daemon --stop --oknodo --signal TERM --pidfile "$PID"
    echo "$NAME was stopped..."
    ;;
  status)
    start-stop-daemon --status --pidfile "$PID"
    if [ $? = 1 ]; then
        echo "drone is not runnning..."
    else
        echo "drone is runnning!"
    fi
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: gf {start|stop|restart|status}"
    exit 1
esac

exit 0
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?