diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2020-04-16 14:49:59 +0000 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2020-04-16 14:49:59 +0000 |
commit | ae5215e025daae99b3ebfe22cd65310eebbdfc70 (patch) | |
tree | 95bc399a7e716d1a06cd630891cabc9b67eedc7b /irc/iroffer-dinoex/files/iroffer.in | |
parent | science/erkale: fix build on GCC architectures (diff) |
- cleanup rc.d script
Notes
Notes:
svn path=/head/; revision=531850
Diffstat (limited to 'irc/iroffer-dinoex/files/iroffer.in')
-rw-r--r-- | irc/iroffer-dinoex/files/iroffer.in | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/irc/iroffer-dinoex/files/iroffer.in b/irc/iroffer-dinoex/files/iroffer.in new file mode 100644 index 000000000000..b9aa05d0b833 --- /dev/null +++ b/irc/iroffer-dinoex/files/iroffer.in @@ -0,0 +1,56 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: iroffer +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# iroffer_enable="YES" +# iroffer_flags="<set as needed>" +# iroffer_user="<set to username>" +# iroffer_bin="<change for language specific version>" +# iroffer_dir="<chdir to this>" +# iroffer_config="<name of the config file>" +# +# See iroffer(1) for iroffer_flags +# + +. /etc/rc.subr + +name="iroffer" +desc="Iroffer IRC Bot" +rcvar="iroffer_enable" + +load_rc_config "$name" + +: ${iroffer_enable:="NO"} +: ${iroffer_user:="bot"} +: ${iroffer_bin:="iroffer"} +: ${iroffer_dir:="/home/bot/iroffer/"} +: ${iroffer_config:="${iroffer_dir}mybot.config"} + +start_precmd="iroffer_checkdisk" +restart_precmd="iroffer_checkdisk" +required_files="${iroffer_config}" +command="${iroffer_dir}/${iroffer_bin}" +if [ -n "${iroffer_dir}" ]; then + command_args="${command_args} -w ${iroffer_dir}" +fi +command_args="${command_args} -u ${iroffer_user}" +command_args="${command_args} -b ${iroffer_config}" +pidfile="${iroffer_dir}/mybot.pid" + +iroffer_checkdisk() +{ + cd "${iroffer_dir}" + if [ -n "${iroffer_dir}" ]; then + freespace=`df -k . | tail -1 | awk {'print $4'}` + if [ "${freespace}" -lt 10 ]; then + echo "Filesystem Full!" >&2 + exit + fi + fi +} + +run_rc_command "$1" |