import cinit from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
parent
3729fc68eb
commit
423ba10303
13396 changed files with 269468 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-20, 0110 CEST
|
||||
# cconfig: create makefile from conf/ directory
|
||||
# currently: all files
|
||||
# later: only built-defines
|
||||
#
|
||||
|
||||
|
||||
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
|
||||
|
||||
echo "#"
|
||||
echo "# Warning: Autogenerated by $0, do not edit. "
|
||||
echo "#"
|
||||
for conf in ${CONFS}; do
|
||||
NAME="$(basename $conf | tr a-z A-Z)"
|
||||
value=$(head -n 1 $conf)
|
||||
|
||||
echo "${NAME}=${value}"
|
||||
done
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: build environment to be used in scripts
|
||||
# * Should be sourced by using scripts
|
||||
# 2006-10-26
|
||||
#
|
||||
|
||||
. $(dirname $0)/cinit.read-conf
|
||||
|
||||
export BASEDIR=${DESTDIR}${CINIT_DIR}
|
||||
export SERVICES=${BASEDIR}/${SVCDIR}
|
||||
export CONFIG=${BASEDIR}/${CONFDIR}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: read configuration into variables
|
||||
# Date: 2005-05-24 (Last Changed: 2005-08-08)
|
||||
|
||||
# try environment first
|
||||
if [ "$CINIT_CONF_DIR" ]; then
|
||||
CONFDIR=$CINIT_CONF_DIR
|
||||
elif [ -d $(dirname $0)/../conf/ ]; then
|
||||
CONFDIR=$(dirname $0)/../conf/
|
||||
else
|
||||
echo 'Did not find cinit configuration!' >&2
|
||||
echo "Please set the variable CINIT_CONF_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $CONFDIR
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: install standard sub-configuration directories
|
||||
# Date: 2005-08-07
|
||||
#
|
||||
|
||||
. $(dirname $0)/cinit.build-env
|
||||
|
||||
for svc in $SERVICE_CATEGORIES; do
|
||||
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${SERVICES}/${svc}"
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: create header file
|
||||
#
|
||||
|
||||
|
||||
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
|
||||
|
||||
echo "/* Warning: Autogenerated by $0, do not edit. */"
|
||||
for conf in $CONFS; do
|
||||
NAME="$(basename $conf | tr a-z A-Z)"
|
||||
value=$(head -n 1 $conf)
|
||||
|
||||
# check if numeric: no quotes needed
|
||||
is_numeric=$(echo $value | awk '/^((0[xX])[0-9a-fA-F]+)|([0-9]+)$/ { print }')
|
||||
is_string="$(echo $value | grep '^"')"
|
||||
|
||||
#
|
||||
# Check for quote type
|
||||
#
|
||||
if [ ! "$is_numeric" -a ! "$is_string" ]; then
|
||||
one_char=$(echo -n $value | wc -c)
|
||||
|
||||
if [ "$one_char" -eq 1 ]; then
|
||||
value="'$value'"
|
||||
else
|
||||
# is a string
|
||||
value="\"$value\""
|
||||
fi
|
||||
fi
|
||||
echo "#define" "$NAME" "$value"
|
||||
done
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# cinit: read configuration into variables
|
||||
# ~ 2005
|
||||
#
|
||||
|
||||
CONFS=$($(dirname $0)/cinit.get-confdir)
|
||||
|
||||
set -e
|
||||
|
||||
for conf in ${CONFS}/*; do
|
||||
NAME="$(basename $conf | tr a-z A-Z)"
|
||||
if eval test -z \$$NAME; then
|
||||
eval $NAME=\"$(head -n 1 $conf)\"
|
||||
eval export $NAME
|
||||
fi
|
||||
# eval echo $NAME = \$$NAME
|
||||
done
|
||||
|
|
@ -0,0 +1 @@
|
|||
Scripts used to generate or aid in creating a configuration.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Reads list of services to create from stdin
|
||||
# Create services (add correct dependencies)
|
||||
#
|
||||
# Options:
|
||||
# -d: alternate destination directory (instead of /etc/cinit/svc)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Reads list of services to enabled from stdin
|
||||
# Services must already exist
|
||||
#
|
||||
# Options:
|
||||
# -d: alternate destination directory (instead of /etc/cinit/svc)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Search for enabled services:
|
||||
# - /etc/rc.conf
|
||||
# - /usr/local/etc/rc.d/
|
||||
# Output list of services to stdout
|
||||
#
|
||||
# Options:
|
||||
# -r <alternate root directory>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-05-21
|
||||
#
|
||||
# Task:
|
||||
# Search all services:
|
||||
# - /etc/rc.conf
|
||||
# - /usr/local/etc/rc.d/
|
||||
# Output list of all services to stdout
|
||||
#
|
||||
# Options:
|
||||
# -r <alternate root directory>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2006-10-23
|
||||
# cLinux/cinit
|
||||
|
||||
. $(dirname $0)/cinit.build-env
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p "${BASEDIR}"
|
||||
|
||||
mkdir -p "${SERVICES}"
|
||||
mkdir -p "${SERVICES}/${C_INIT}"
|
||||
|
||||
mkdir -p "${CONFIG}"
|
||||
|
|
@ -0,0 +1 @@
|
|||
Only to be used by Nico Schottelius.
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# Build release tar
|
||||
# Date: Sat Oct 15 21:38:29 CEST 2005
|
||||
# Last Changed: ls -l
|
||||
|
||||
# only release if I tell it to release
|
||||
[ "$1" = "now" ] || exit 23
|
||||
|
||||
#if [ $# -ne 2 ]; then
|
||||
# echo "This is a maintainer-only script to release cinit"
|
||||
# echo $(basename $0): source-dir version
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
# paths
|
||||
DIR="$(cd $(dirname $0)/../../; pwd -P)"
|
||||
DDIR="$(cd $(dirname $0)/../../../; pwd -P)"
|
||||
RDIR=$(basename "$DIR")
|
||||
|
||||
# version
|
||||
VERSION="$(cd "$DIR"; pwd -P | sed 's;.*/cinit-;;')"
|
||||
VERSION_CONF="$(head -n1 $(dirname $0)/../../conf/version | sed 's/^"\(.*\)"$/\1/')"
|
||||
VERSION_CHANGES="$(head -n1 "$(dirname $0)/../../CHANGES" | sed 's/cinit-\(.*\):.*/\1/')"
|
||||
OUT_NAME="cinit-${VERSION}.tar.bz2"
|
||||
|
||||
# remote
|
||||
D_HOST=home.schottelius.org
|
||||
D_BASE=www/org/schottelius/unix/www/cinit
|
||||
D_DIR=${D_BASE}/archives/
|
||||
D_SOURCE=${D_BASE}/browse_source/
|
||||
LINK=current
|
||||
|
||||
echo "=> Version directory: $VERSION"
|
||||
echo "=> Version conf/version: $VERSION_CONF"
|
||||
echo "=> Version CHANGES: $VERSION_CHANGES"
|
||||
|
||||
if [ "$VERSION" = "$VERSION_CONF" -a "$VERSION" = "$VERSION_CHANGES" ]; then
|
||||
echo "=> Version confirmed."
|
||||
else
|
||||
echo "*** VERSION MISMATCH ***"
|
||||
exit 42
|
||||
fi
|
||||
|
||||
echo -n "=> Continue? "
|
||||
read yes
|
||||
|
||||
if [ ! -d "$DIR" ]; then
|
||||
echo "$DIR is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# do the work!
|
||||
( cd "$DIR" && make dist ) || exit 1
|
||||
|
||||
echo "Creating bzip2 compressed tar"
|
||||
cd $DDIR
|
||||
tar cj -X $DIR/.exclude -f "$OUT_NAME" "$RDIR"
|
||||
chmod 0644 "$OUT_NAME"
|
||||
|
||||
echo "Transfering to $D_HOST"
|
||||
scp "$OUT_NAME" "$D_HOST:$D_DIR"
|
||||
|
||||
echo "Extracting to $D_SOURCE"
|
||||
ssh "$D_HOST" "tar xfj $D_DIR/$OUT_NAME -C $D_SOURCE"
|
||||
|
||||
echo "Correcting paranoid permissions"
|
||||
ssh "$D_HOST" "find \"$D_SOURCE/$RDIR\" -type f -exec chmod 0644 {} \\;"
|
||||
ssh "$D_HOST" "find \"$D_SOURCE/$RDIR\" -type d -exec chmod 0755 {} \\;"
|
||||
ssh "$D_HOST" "cd \"$D_SOURCE\" && rm -f \"$LINK\" && ln -s \"$RDIR\" \"$LINK\""
|
||||
|
||||
echo "Please do not forget to update the website..."
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# yah - yet another hack
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo "HOSTNAME"
|
||||
exit 23
|
||||
fi
|
||||
|
||||
host="$1"
|
||||
|
||||
hier=$(dirname $0)
|
||||
|
||||
$hier/compile_test.sh "$host"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "aborting, did not compile on $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ssh "${host}" './cinit/src/cinit & (sleep 30; kill -9 $(pgrep cinit))'
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# just a hack
|
||||
|
||||
dir=$(dirname $0)
|
||||
|
||||
sys=$(uname -s)
|
||||
sys_small=$(echo $sys | tr '[A-Z]' '[a-z]')
|
||||
|
||||
case $(uname -s) in
|
||||
NetBSD|OpenBSD)
|
||||
make=gmake
|
||||
;;
|
||||
*)
|
||||
make=make
|
||||
;;
|
||||
esac
|
||||
|
||||
cd "${dir}/../../"
|
||||
echo $sys_small > conf/os
|
||||
# automatically called by make..
|
||||
#./bin/cinit.configure.os
|
||||
|
||||
cd "src"
|
||||
$make clean
|
||||
$make cinit
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
what=$(dirname $0)/../../
|
||||
what_real=$(cd "$what" && pwd -P)
|
||||
dest=~compiler/cinit-test
|
||||
|
||||
set -e
|
||||
sudo rsync -av "${what_real}/" "$dest"
|
||||
sudo chown -R compiler "$dest"
|
||||
sudo -u compiler "${dest}/scripts/internal/compile_local.sh"
|
||||
sudo -u compiler "${dest}/src/cinit" &
|
||||
sleep 13
|
||||
sudo -u compiler "${dest}/scripts/internal/stop_cinit.sh"
|
||||
|
||||
# exit 0 for make
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
# yah - yet another hack
|
||||
|
||||
host="$1"
|
||||
what=$(dirname $0)/../../
|
||||
|
||||
rsync --exclude .git --exclude \*.o -av "${what}" "${host}:cinit"
|
||||
ssh "${host}" "./cinit/scripts/internal/compile_local.sh"
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
hier=$(dirname $0)
|
||||
|
||||
set -e
|
||||
${hier}/../cinit.install.standard.dirs
|
||||
cat > /etc/cinit/svc/init/on << eof
|
||||
#!/bin/sh
|
||||
echo test1
|
||||
sleep 4
|
||||
echo test2 - \$@
|
||||
eof
|
||||
chmod 0755 /etc/cinit/svc/init/on
|
||||
|
||||
cat > /etc/cinit/svc/init/on.params << eof
|
||||
es
|
||||
scheint
|
||||
zu
|
||||
gehen
|
||||
eof
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
src="$(dirname $0)/../../"
|
||||
src_abs=$(cd "$src" && pwd -P)
|
||||
|
||||
for commit in $( git log --pretty=short | awk '/^commit/ { print $2 }'); do
|
||||
set -e
|
||||
cd "$src_abs"
|
||||
temp=$(mktemp -d /tmp/cinit.XXXXXXXXXX)
|
||||
git-archive --format=tar "$commit" | ( cd "$temp"; tar x )
|
||||
cd "${temp}/src"
|
||||
set +e
|
||||
make clean && make cinit && ./cinit
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "Commit $commit is ok"
|
||||
exit 0
|
||||
fi
|
||||
echo "Broken $commit"
|
||||
sleep 1
|
||||
set -e
|
||||
rm -rf "$temp"
|
||||
done
|
||||
|
||||
exit 1
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-09-03: For testing cinit in qemu
|
||||
#
|
||||
|
||||
emud="${HOME}/emu"
|
||||
img="${emud}/debian-hd.img"
|
||||
ddir="${emud}/mount"
|
||||
loop=/dev/loop1
|
||||
fsck="/sbin/fsck.jfs"
|
||||
|
||||
# my jfs is on the first partition, 512*63 bytes offset
|
||||
offset="32256"
|
||||
|
||||
set -e
|
||||
set -x
|
||||
sudo losetup -o "${offset}" "${loop}" "${img}"
|
||||
sudo "${fsck}" "${loop}"
|
||||
sudo mount "${loop}" "${ddir}"
|
||||
|
||||
sudo umount "${loop}"
|
||||
sudo losetup -d "${loop}"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
# Linux specific, but don't care, I am the only person that should use it
|
||||
|
||||
killall -TERM cinit
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2007-09-27: Test cmd
|
||||
#
|
||||
|
||||
|
||||
echo "Testing cmd..."
|
||||
sudo /sbin/cmd -s /etc/cinit/svc/init
|
||||
sudo /sbin/cmd -p /etc/cinit/svc/init
|
||||
sudo /sbin/cmd -v
|
||||
sudo /sbin/cmd -V
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
# yah
|
||||
|
||||
hosts="penrose.bsdprojects.net jiffies.forkbomb.ch ddna044.netstream.ch"
|
||||
|
||||
set -e
|
||||
|
||||
for host in $hosts; do
|
||||
echo "$1 on $host"
|
||||
"$1" "$host" | sed "s/^/${host}: /"
|
||||
echo "==> Finished $host"
|
||||
done
|
||||
|
|
@ -0,0 +1 @@
|
|||
valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --leak-resolution=high ./cinit
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2006-12-08
|
||||
# Report compile success
|
||||
#
|
||||
|
||||
echo "cinit compile success report"
|
||||
echo "----------------------------"
|
||||
"$(dirname $0)/cinit.mkheader"
|
||||
echo "----------------------------"
|
||||
uname -a
|
||||
echo "----------------------------"
|
||||
. "$(dirname $0)/cinit.read-conf"
|
||||
echo '$CC'
|
||||
"$CC" -v
|
||||
echo "----------------------------"
|
||||
echo -n "Size: "
|
||||
ls -l "$(dirname $0)/../src/cinit"
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius (nico-cinit /at/ schottelius.org)
|
||||
# 2007-05-21
|
||||
# Behave as being shutdown from Linux' sysvinit
|
||||
|
||||
# Always needed variables / functions
|
||||
_0_short=${0##*/}
|
||||
_o_seperator=":"
|
||||
_oecho_seperator=":"
|
||||
_eecho_seperator=">"
|
||||
|
||||
# ok-exit/echo
|
||||
_oecho()
|
||||
{
|
||||
echo "${_0_short}${_oecho_seperator}" "$@"
|
||||
}
|
||||
|
||||
_oexit()
|
||||
{
|
||||
_oecho "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# error-exit/echo
|
||||
_eecho()
|
||||
{
|
||||
echo "${_0_short}${_oecho_seperator}" "$@" >&2
|
||||
}
|
||||
|
||||
_eexit()
|
||||
{
|
||||
_eecho "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Program specific variables
|
||||
|
||||
time_t=0 # -t sec
|
||||
warn_only_k=0 # -k
|
||||
reboot_r=0 # -r
|
||||
halt_h=0 # -h
|
||||
poweroff_P=0 # -P
|
||||
cancel_c=0 # -c
|
||||
time=-1 # [time]
|
||||
message="" # [warning-message]
|
||||
cmd="" # what to execute internally
|
||||
pidfile="/var/run/cinit.shutdown"
|
||||
pid=""
|
||||
runs=""
|
||||
|
||||
version="0.1"
|
||||
version_date="2007-10-30"
|
||||
|
||||
message_intro="The system is going down for"
|
||||
message_reboot="reboot"
|
||||
message_halt="halt"
|
||||
message_poweroff="poweroff"
|
||||
|
||||
# unimplemented: -a, -H, -f, -F
|
||||
# deprecated and thus not implemented: -n
|
||||
|
||||
# traping signals
|
||||
trap_signals()
|
||||
{
|
||||
_oexit "Aborted shutdown"
|
||||
}
|
||||
|
||||
# all the functions
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
cat << cinit_usage
|
||||
|
||||
*** cinit linux-sysvinit shutdown wrapper (Version ${version} ${version_date}) ***
|
||||
|
||||
Usage shutdown [-akrhHPfnc] [-t secs] time [warning message]
|
||||
-a: use /etc/shutdown.allow
|
||||
-k: don't really shutdown, only warn.
|
||||
-r: reboot after shutdown.
|
||||
-h: halt after shutdown.
|
||||
-P: halt action is to turn off power.
|
||||
-H: halt action is to just halt.
|
||||
-f: do a 'fast' reboot (skip fsck).
|
||||
-F: Force fsck on reboot.
|
||||
-n: do not go through "init" but go down real fast.
|
||||
-c: cancel a running shutdown.
|
||||
-t secs: delay between warning and kill signal.
|
||||
** the "time" argument is mandatory! (try "now") **
|
||||
|
||||
You can also call "cinit.{halt|reboot|poweroff}" directly
|
||||
(instead of using this wrapper).
|
||||
|
||||
cinit_usage
|
||||
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
warn()
|
||||
{
|
||||
( echo ""; echo "$@"; echo "" ) | wall
|
||||
( echo ""; echo "$@"; echo "" )
|
||||
}
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# getopt!
|
||||
while [ "$#" -ge 1 ]; do
|
||||
arg="$1"; shift
|
||||
|
||||
case "${arg}" in
|
||||
-a|-F|-f|-n)
|
||||
_oexit "Sorry, ${arg} is not implemented."
|
||||
;;
|
||||
-t)
|
||||
if [ "$#" -lt 1 ]; then
|
||||
_eexit "-t needs the time argument"
|
||||
fi
|
||||
time_t="$1"; shift
|
||||
;;
|
||||
-k)
|
||||
warn_only_k=1
|
||||
cmd=true
|
||||
;;
|
||||
-r)
|
||||
reboot_r=1
|
||||
cmd=cinit.reboot
|
||||
message_what="${message_reboot}"
|
||||
;;
|
||||
-h|-H)
|
||||
halt_h=1
|
||||
cmd=cinit.halt
|
||||
message_what="${message_halt}"
|
||||
;;
|
||||
-P)
|
||||
poweroff_P=1
|
||||
cmd=cinit.poweroff
|
||||
message_what="${message_poweroff}"
|
||||
;;
|
||||
-c)
|
||||
cancel_c=1
|
||||
;;
|
||||
*)
|
||||
# time unset?
|
||||
if [ "${time}" = -1 ]; then
|
||||
time="${arg}"
|
||||
[ "${time}" = "now" ] && time=0
|
||||
elif [ -z "${message}" ]; then
|
||||
message="${arg}"
|
||||
else
|
||||
_eexit "Already specified time and message"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -f "${pidfile}" ]; then
|
||||
pid=$(cat "${pidfile}")
|
||||
runs=$(kill -CONT "${pid}" >/dev/null 2>&1 && echo yes)
|
||||
fi
|
||||
|
||||
# do cancel or abort or locking
|
||||
if [ "${cancel_c}" -eq 1 ]; then
|
||||
if [ "${runs}" ]; then
|
||||
kill -TERM "${pid}"
|
||||
_oexit "Terminated running shutdown at \"${pid}\"."
|
||||
else
|
||||
_eexit "Cannot abort shutdown, not running."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${time}" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -z "${cmd}" ]; then
|
||||
_eexit "You need to specify one of -h, -P, -H, -r."
|
||||
fi
|
||||
|
||||
# add lock
|
||||
if [ "${pid}" ]; then
|
||||
if [ "${runs}" ]; then
|
||||
_eexit "Shutdown already running."
|
||||
else
|
||||
_oecho "Overwriting stale pidfile"
|
||||
fi
|
||||
fi
|
||||
echo $$ > "${pidfile}"
|
||||
|
||||
if [ "${message}" ]; then
|
||||
warn "${message}"
|
||||
fi
|
||||
|
||||
# signals to abort on
|
||||
trap trap_signals INT HUP TERM
|
||||
|
||||
while [ "${time}" -gt 0 ]; do
|
||||
warn "${message_intro} ${message_what} in ${time} minute(s)."
|
||||
sleep 60
|
||||
time=$((${time}-1))
|
||||
done
|
||||
|
||||
warn "${message_intro} ${message_what} now."
|
||||
"${cmd}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue