lsyncd/tests/pidfile.sh
Junichi Uekawa f62c1f3cc2 make --pidfile option for handling pids.
Add manpage on the way
2008-10-08 04:08:52 +00:00

24 lines
407 B
Bash
Executable File

#!/bin/bash
set -e
WORKTARGET=$(mktemp -d)
PIDFILE=$(mktemp)
LOGFILE=$(mktemp)
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" . "${WORKTARGET}"
sleep 1s
LSYNCPID=$(cat "${PIDFILE}")
if ! kill "${LSYNCPID}"; then
echo "kill failed"
exit 1
fi
sleep 1s
if kill "${LSYNCPID}"; then
echo process still exists after kill
exit 1
fi
rm "${PIDFILE}"
rm "${LOGFILE}"
rm -rf "${WORKTARGET}"