Linux shell exit code or last message

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Linux shell exit code or last message

Post by plittlefield »

Does FileBot have an exit code or last error message we can access?

I ask because sometimes it fails during an operation and my normal push notification just has "done".

It would be good if I could add say, the last line of the output or an exit code to my Pushover notification.

e.g.

Error

Code: Select all

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f9231686d33, pid=26631, tid=0x00007f9248f7c700
#
# JRE version: OpenJDK Runtime Environment (8.0_252-b09) (build 1.8.0_252-8u252-b09-1~16.04-b09)
# Java VM: OpenJDK 64-Bit Server VM (25.252-b09 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J 1876 C1 groovyjarjarantlr4.v4.runtime.atn.ParserATNSimulator.addDFAState(Lgroovyjarjarantlr4/v4/runtime/dfa/DFA;Lgroovyjarjarantlr4/v4/runtime/atn/ATNConfigSet;Lgroovyjarjarantlr4/v4/runtime/atn/PredictionContextCache;)Lgroovyjarjarantlr4/v4/runtime/dfa/DFAState; (226 bytes) @ 0x00007f9231686d33 [0x00007f9231684a20+0x2313]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/paully/Downloads/seedbox2/completed/hs_err_pid26631.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Aborted
Notification

python /usr/bin/pushover-cli --quiet "$t ...done with exit code `echo $?`" "FileBot"


Code: Select all

$ command1 2> error.log
Thanks,

Paully

Code: Select all

FileBot 4.9.1 (r7372) JDK8
JNA Native: 4.0.1
MediaInfo: 20.03.20200411
p7zip: p7zip Version 9.20 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
unrar: UNRAR 5.30 beta 2 freeware
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2020-05-22 (r644)
Groovy: 3.0.3
JRE: OpenJDK Runtime Environment 1.8.0_252
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 4 Core / 3.7 GB Max Memory / 74 MB Used Memory
OS: Linux (amd64)
HW: Linux nas 4.15.0-15-generic #16~16.04.1-Ubuntu SMP Thu Apr 5 12:19:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
DATA: /home/paully/.filebot
Package: DEB
License: FileBot License            (Valid-Until: 2020-07-31)
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Linux shell exit code or last message

Post by rednoah »

1.
As for solving the problem at the source, upgrading to the latest and greatest Java 14.0.1 would be my first step.


2.
If the FileBot process crashes, then the process will most assuredly terminate with a non-zero exit code, likely dump lots of debug information into stderr too.

:idea: You may need to configure your pushover-cli call to thoroughly capture all output, and not just stdout. My send-email-log.sh can serve as an example here.
:idea: Please read the FAQ and How to Request Help.
plittlefield
Posts: 101
Joined: 09 Mar 2014, 19:15

Re: Linux shell exit code or last message

Post by plittlefield »

Perfect!

I have used this...

Code: Select all

    if [ $? -eq 0 ]; then
      STATUS="OK"
    else
      STATUS="FAILURE"
    fi
    python /usr/bin/pushover-cli --quiet "$STATUS - $t ...done!" "FileBot"
Post Reply