2014-07-07 08:52:47 +00:00
|
|
|
#!/bin/sh
|
2015-02-23 07:02:25 +00:00
|
|
|
|
|
|
|
# symlink to /bin on START and unlink on STOP
|
2015-05-16 04:52:25 +00:00
|
|
|
APP_LINK="/usr/local/bin/$SYNOPKG_PKGNAME"
|
2015-03-29 09:55:31 +00:00
|
|
|
APP_ROOT="$SYNOPKG_PKGDEST"
|
2015-02-23 07:02:25 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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
|
2015-02-23 07:02:25 +00:00
|
|
|
# 0: package is running
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
# 3: package is not running
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
2015-02-23 07:56:01 +00:00
|
|
|
|
2015-03-29 09:55:31 +00:00
|
|
|
log)
|
2015-03-29 17:28:34 +00:00
|
|
|
# select most recently modified log file
|
|
|
|
find "$APP_ROOT/data" -name "*.log" -type f -print0 | xargs -0 ls -Alt1 | head -n 1 | sed -e 's/\s\+/\s /g' | cut -d' ' -f7-
|
2015-03-29 09:55:31 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2015-02-23 07:56:01 +00:00
|
|
|
|
2015-03-29 09:55:31 +00:00
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|