Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't exit with 100 status code in amc if no files are found #55

Closed
danielcompton opened this issue Apr 29, 2019 · 1 comment
Closed

Comments

@danielcompton
Copy link

danielcompton commented Apr 29, 2019

In 18bcc76 this line was changed:

scripts/amc.groovy

Lines 299 to 302 in a921ac5

// early abort if there is nothing to do
if (input.size() == 0) {
die "No files selected for processing", ExitCode.NOOP
}

Previously it exited with status 0, and now it exits with status 100.

Exiting with a non-zero status code tells my Synology that execution failed and it notifies me about it. If there are no files selected for processing, this doesn't seem like an exceptional situation? At least in my situation of running a scheduled task, it would be much more useful if it continued to exit with a zero status code unless there truly was an error. What are your thoughts?

@rednoah
Copy link
Member

rednoah commented Apr 29, 2019

4.8.5 has different error codes for different errors. Running the amc script on an input folder where there is nothing to do can be considered an error, or it cannot, depending on the use case and what might be convenient for the end user at the time.

0 indicates a success run, while 100 indicates that nothing happened successfully.

Since your problem is specific to Synology Scheduler, I recommend a solution specific to Synology Scheduler.

Just add this to the end of your scheduled task:

STATUS=$?
# treat ExitCode.NOOP as ExitCode.SUCCESS
if [ $STATUS -eq 100 ]; then
	exit 0
fi
exit $STATUS

If you're using FileBot Node, then that'll be default for scheduled tasks:
https://github.com/filebot/filebot-node/blob/master/package/synology/bin/task#L14

@rednoah rednoah closed this as completed Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants