daemonize

This commit is contained in:
f 2019-09-30 16:26:54 -03:00
parent 6c766bcfef
commit ab37995bd0
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
4 changed files with 12 additions and 12 deletions

View file

@ -9,9 +9,8 @@ RUN tar x -Of syncthing-linux-amd64-v${VERSION}.tar.gz syncthing-linux-amd64-v${
RUN chmod +x /usr/local/bin/syncthing
RUN strip --strip-all /usr/local/bin/syncthing
COPY ./syncthing_stop.sh /usr/local/bin/syncthing_stop
COPY ./syncthing_start.sh /usr/local/bin/syncthing_start
RUN chmod 755 /usr/local/bin/syncthing_stop /usr/local/bin/syncthing_start
RUN chmod 755 /usr/local/bin/syncthing_start
RUN echo /home/builder/packages/home > /etc/apk/repositories
RUN apk add --no-cache daemonize
@ -19,7 +18,6 @@ RUN apk add --no-cache daemonize
FROM sutty/monit:latest
COPY --from=build /usr/local/bin/syncthing /usr/local/bin/syncthing
COPY --from=build /usr/local/bin/syncthing_stop /usr/local/bin/syncthing_stop
COPY --from=build /usr/local/bin/syncthing_start /usr/local/bin/syncthing_start
COPY --from=build /usr/sbin/daemonize /usr/sbin/daemonize
COPY ./monit.conf /etc/monit.d/syncthing.conf

View file

@ -1,3 +1,3 @@
check process syncthing with pidfile /tmp/syncthing.pid
start program = "/usr/local/bin/syncthing_start" as uid "syncthing"
stop program = "/usr/local/bin/syncthing_stop"
start program = "/usr/local/bin/syncthing_start"
stop program = "/bin/sh -c 'cat /tmp/syncthing.pid | xargs kill'"

View file

@ -1,6 +1,11 @@
#!/bin/sh
daemonize -p /tmp/syncthing.pid -l /tmp/syncthing.pid \
/usr/local/bin/syncthing -no-browser \
-logfile="/home/syncthing/syncthing.log" \
-gui-address="http://0.0.0.0:8443"
pid=/tmp/syncthing.pid
dir=/home/syncthing
log=/dev/log
rm -f ${pid}
daemonize -p ${pid} -l ${pid} -u syncthing -c ${dir} \
-o ${log} -a -e ${log} \
/usr/local/bin/syncthing -no-browser -gui-address='http://0.0.0.0:8443'

View file

@ -1,3 +0,0 @@
#!/bin/sh
ps aux | grep syncthing | tr -s " " | cut -d " " -f 2 | xargs kill