mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-13 22:48:29 +00:00
30 lines
649 B
Bash
Executable File
30 lines
649 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
CON="\E[47;34m"
|
|
COFF="\033[0m"
|
|
|
|
echo -e "$CON**************************************************$COFF"
|
|
echo -e "$CON** Checking if lsyncd writes a correct pidfile. **$COFF"
|
|
echo -e "$CON**************************************************$COFF"
|
|
|
|
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}"
|
|
|