filebot/installer/spk/scripts/start-stop-status

41 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# symlink to /bin on START and unlink on STOP
2015-03-29 09:55:31 +00:00
APP_LINK="/usr/syno/bin/filebot"
APP_ROOT="$SYNOPKG_PKGDEST"
case "$1" in
start)
# When the user clicks the button "Run" to run the package, after the package is installed, or when the DiskStation is turned on.
2015-03-29 09:55:31 +00:00
ln -s "$APP_ROOT/filebot.sh" "$APP_LINK"
exit 0
;;
stop)
# When the user clicks the button "Stop" to stop the running package, before the package is uninstalled, or when the DiskStation is turned off.
2015-03-29 09:55:31 +00:00
rm -f "$APP_LINK"
exit 0
;;
status)
# When Package Center is opened to check package status, the Center will send a request to ask the status of the package with this parameter.
2015-03-29 09:55:31 +00:00
if [ -e "$APP_LINK" ]; then
# 0: package is running
exit 0
else
# 3: package is not running
exit 1
fi
;;
2015-03-29 09:55:31 +00:00
log)
2015-03-29 10:17:04 +00:00
# Select most recently modified log file (Caveats: the path of the log file must not contain spaces)
2015-03-29 10:08:00 +00:00
find "$APP_ROOT/data" -name "*.log" -type f -print0 | xargs -0 ls -Alt1 | head -n 1 | awk '{print $7}'
2015-03-29 09:55:31 +00:00
exit 0
;;
2015-03-29 09:55:31 +00:00
*)
exit 1
;;
esac