From a4ce3f8999d3efae60d7a52b7edc024706d96a51 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Wed, 7 Oct 2015 19:30:12 +0300 Subject: [PATCH] Various example startup scripts --- startup/debian.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ startup/freebsd.rc | 15 +++++++++++++++ startup/upstart.conf | 6 ++++++ 3 files changed, 64 insertions(+) create mode 100755 startup/debian.sh create mode 100644 startup/freebsd.rc create mode 100644 startup/upstart.conf diff --git a/startup/debian.sh b/startup/debian.sh new file mode 100755 index 0000000..cc31d24 --- /dev/null +++ b/startup/debian.sh @@ -0,0 +1,43 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: goircd +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: goircd IRC server +# Description: goircd IRC server +### END INIT INFO + +NAME=goircd +DAEMON=/home/goircd/goircd +PIDFILE=/var/run/goircd.pid + +. /lib/lsb/init-functions + +case "$1" in + start) + log_daemon_msg "Starting $NAME daemon" "$NAME" + start-stop-daemon --start --quiet --background \ + --pidfile $PIDFILE --make-pidfile --exec $DAEMON \ + -- -hostname irc.example.com + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping $NAME daemon" "$NAME" + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE + log_end_msg $? + rm -f $PIDFILE + ;; + restart) + $0 stop || : + $0 start + ;; + status) + status_of_proc -p $PIDFILE "$NAME" "$NAME" + ;; + *) + echo "Usage: /etc/init.d/goircd {start|stop|restart|status}" + exit 1 +esac diff --git a/startup/freebsd.rc b/startup/freebsd.rc new file mode 100644 index 0000000..53bc8d9 --- /dev/null +++ b/startup/freebsd.rc @@ -0,0 +1,15 @@ +#!/bin/sh +# + +# PROVIDE: goircd +# REQUIRE: FILESYSTEMS NETWORKING + +. /etc/rc.subr + +name="goircd" +rcvar=goircd_enable +command="/home/goircd/goircd" +command_args="-hostname irc.example.com &" + +load_rc_config $name +run_rc_command "$1" diff --git a/startup/upstart.conf b/startup/upstart.conf new file mode 100644 index 0000000..8a06661 --- /dev/null +++ b/startup/upstart.conf @@ -0,0 +1,6 @@ +description "goircd IRC server" + +start on (started networking) +stop on (stopped networking) +console log +exec /home/goircd/goircd -hostname irc.example.com -- 2.44.0