HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: //var/packages/SynoFinder/scripts/start-stop-status
#!/bin/sh
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.

. "$(dirname $0)"/common

updatedb()
{
	local DB_PATH="${PACKAGE_DIR}/etc/etc-volume/synofinder.db"
	local DB_UPDATER="${TOOL_DIR}/synofinderdb"

	${TOOL_DIR}/synofinderdb -a update -v 1 -d "update synofinder.db"

	chown SynoFinder:SynoFinder ${DB_PATH}
	chmod 660 ${DB_PATH}
}

start()
{
	${TOOL_DIR}/fileindex -a update_log_location -j "[]"

	/usr/syno/bin/synosystemctl start pkg-SynoFinder-synoelasticd.service
	${TOOL_DIR}/updater
	# FIXME: restarting is bad, achieve settings reloading with socket command
	${TOOL_DIR}/fileindex -a update_etc_location -j "[]"

	updatedb

	/usr/syno/bin/synosystemctl try-restart pkg-SynoFinder-synoelasticd.service
	${TOOL_DIR}/fileindex -a prepare_services -d "start script prepare_services"

	# In case reboot due to either volume or share online failure during VOO
	${TOOL_DIR}/fileindex -a resume_all_normal_shares -d "resume all normal shares"

	${TOOL_DIR}/appindex -a try_reindex -d "start script try_reindex" &
	${TOOL_DIR}/appindex -a add -p ${TARGET_DIR}/ui/index.conf -d "start script add" &
}

stop()
{
	/usr/syno/bin/synosystemctl stop pkg-SynoFinder-fileindexd.service
	/usr/syno/bin/synosystemctl stop pkg-SynoFinder-synoelasticd.service

	${TOOL_DIR}/appindex -a del -p ${TARGET_DIR}/ui/index.conf -d "stop script del"
}

case $1 in
	start)
		start
		exit 0
		;;

	stop)
		stop
		exit 0
		;;

	status)
		if [ -f ${PACKAGE_ENABLED} ]; then
			exit 0
		else
			exit 1
		fi
		;;
esac

exit 0