mirror of
https://github.com/YunoHost-Apps/syncthing_ynh.git
synced 2024-09-03 20:26:23 +02:00
Merge pull request #2 from scamhaji/master
enable log file + logrotate configuration
This commit is contained in:
commit
100472753b
4 changed files with 31 additions and 4 deletions
14
conf/logrotate.conf
Normal file
14
conf/logrotate.conf
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/var/log/syncthing.log {
|
||||||
|
rotate 4
|
||||||
|
weekly
|
||||||
|
minsize 1M
|
||||||
|
missingok
|
||||||
|
create 640 root adm
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
postrotate
|
||||||
|
invoke-rc.d syncthing restart > /dev/null
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ DAEMON_ARGS=" & "
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/var/run/$NAME.pid
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
DAEMONUSER=debian-syncthing
|
DAEMONUSER=debian-syncthing
|
||||||
|
LOGFILE=/var/log/$NAME.log
|
||||||
|
|
||||||
# Exit if the package is not installed
|
# Exit if the package is not installed
|
||||||
[ -x "$DAEMON" ] || exit 0
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
@ -52,9 +53,9 @@ do_start()
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
start-stop-daemon --start --quiet --chuid $DAEMONUSER --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
start-stop-daemon --start --quiet --chuid $DAEMONUSER --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||||
|| return 1
|
|| return 1
|
||||||
start-stop-daemon --start --quiet --chuid $DAEMONUSER --pidfile $PIDFILE --exec $DAEMON -- \
|
start-stop-daemon --start --quiet --chuid $DAEMONUSER --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- \
|
||||||
$DAEMON_ARGS \
|
$DAEMON_ARGS >> $LOGFILE 2>&1 \
|
||||||
|| return 2 & > /dev/null
|
|| return 2 &
|
||||||
# Add code here, if necessary, that waits for the process to be ready
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
# to handle requests from services started subsequently which depend
|
# to handle requests from services started subsequently which depend
|
||||||
# on this one. As a last resort, sleep for some time.
|
# on this one. As a last resort, sleep for some time.
|
||||||
|
@ -157,4 +158,4 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
:
|
|
||||||
|
|
|
@ -70,6 +70,12 @@ sudo update-rc.d syncthing defaults
|
||||||
sudo yunohost service add synchting
|
sudo yunohost service add synchting
|
||||||
sudo service syncthing start
|
sudo service syncthing start
|
||||||
|
|
||||||
|
# Configure logrotate if present
|
||||||
|
if [ -d "/etc/logrotate.d" ]; then
|
||||||
|
sudo cp ../conf/logrotate.conf /etc/logrotate.d/syncthing
|
||||||
|
sudo chmod 0755 /etc/logrotate.d/syncthing
|
||||||
|
fi
|
||||||
|
|
||||||
# Configure Nginx and reload
|
# Configure Nginx and reload
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sed -i "s@PORTTOCHANGE@$syncUIport@g" ../conf/nginx.conf
|
sed -i "s@PORTTOCHANGE@$syncUIport@g" ../conf/nginx.conf
|
||||||
|
|
|
@ -24,6 +24,12 @@ sudo userdel $syncUser
|
||||||
# Close port in firewall
|
# Close port in firewall
|
||||||
sudo yunohost firewall disallow TCP $syncSyncport
|
sudo yunohost firewall disallow TCP $syncSyncport
|
||||||
|
|
||||||
|
# Remove syncthing logrotate configuration
|
||||||
|
if [ -f /etc/logrotate.d/syncthing ]
|
||||||
|
then
|
||||||
|
sudo rm /etc/logrotate.d/syncthing
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove syncthing nginx configuration
|
# Remove syncthing nginx configuration
|
||||||
domain=$(sudo yunohost app setting syncthing domain)
|
domain=$(sudo yunohost app setting syncthing domain)
|
||||||
sudo rm /etc/nginx/conf.d/$domain.d/syncthing.conf
|
sudo rm /etc/nginx/conf.d/$domain.d/syncthing.conf
|
||||||
|
|
Loading…
Add table
Reference in a new issue