Closed brendanjcaffrey closed 3 weeks ago
I tested autorestart with Gateway 10.31.1i on Ubuntu 22.04 with IBC 3.20.0 earlier this evening and it worked fine.
The reason why it's not working for you is that you have:
TWS_SETTINGS_PATH=/home/storm/ibc/live/settings/
in your gatewaystart.sh
script. Unfortunately the script expects this path not to have the terminating '/'.
I'll amend the script to be insensitive to whether the final path separator is present or not. For now, just remove the final separator.
@rlktradewright Hi Richard,
You can improve this by +1 line:
TWS_SETTINGS_PATH=$(readlink -f "${TWS_SETTINGS_PATH}")
Ubuntu core utils have "readlink" as a part of ubuntu, it is available by default on all standard Ubuntu installations. The above command will get rid of extra "/" at the end of the path (if it was present).
Here's what "-f" option is doing:
-f, --canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must ex‐ ist
Example / demo (removes "/"):
`dmitry@moon:~$ readlink -f /tmp/some_folder/
/tmp/some_folder
dmitry@moon:~$ readlink -f /tmp/some_folder
/tmp/some_folder
`Note: path must exist (all but the last component), so if you run command to some non-existing path, like:
dmitry@moon:~$ readlink -f /tmp/some_folder/non_existing/path/1/2/3
Then it will produce no output (you'll get an empty string) and non-zero exit code, which you could check like this:
TWS_SETTINGS_PATH=$(readlink -f "${TWS_SETTINGS_PATH}") || { echo "Error: folder does not exist: '${TWS_SETTINGS_PATH}'"; exit 1; }
But to make the "folder existence check" more reliable (not allow optional existence of the last path component) I'd rather add +1 line with explicit check, like "if [ ! -d "${TWS_SETTINGS_PATH}" ]; then error... The "if -d" test does not care about extra "/" at the end, so final solution would be to add:
# Check folder exists
if [ ! -d "${TWS_SETTINGS_PATH}" ]; then
echo "Error: TWS_SETTINGS_PATH points to non-existing folder: '${TWS_SETTINGS_PATH}'" >&2
exit 1
fi
# Sanitise TWS_SETTINGS_PATH (remove trailing "/" if present)
TWS_SETTINGS_PATH=$(readlink -f "${TWS_SETTINGS_PATH}") || { echo "Error: failed to sanitise TWS_SETTINGS_PATH value: '${TWS_SETTINGS_PATH}'" >&2; exit 1; }
@shevkoplyas
Thanks for the suggestion, Dmitry. I wasn't aware of the readlink
command, being not much of a 'bash'-er.
However it seems to me that just using:
shopt -s extglob
tws_settings_path=${tws_settings_path%%+(/)}
is more straightforward. This will remove multiple trailing separators.
Thanks for your help, Richard. Removing the trailing slash fixed the problem for me.
Hello,
I've been having issues with autorestart since I upgraded to IBC 3.18 (from 3.16). I tried today upgrading to 3.20 and the issue persists. It works fine running the gateway without IBC. The IBC log always ends with
autorestart file not found
, which I tracked down tofind_auto_restart
inibcstart.sh
. Changing the-f3
on line 348 to a-f2
fixes the issue for me.From what I can gather, the code there expects the autorestart file to be something like
$tws_settings_path/userid/otherdir/autorestart
but it's$tws_settings_path/userid/autorestart
on my machine. Maybe IB changed that recently?I'm attaching the full log for today. I ran it several times, setting the auto restart time to a short time after each start. Starting with the run at
2024-09-14 at 13:24:24
, I added some debug logging intofind_auto_restart
, which helped me identify the issue. (Please ignore that I set the AutoRestart config setting in the wrong format 4 times in a row)Thanks!
ibc-3.20.0_GATEWAY-1031_Saturday.txt
[Edit: I initially uploaded the wrong IBC log, sorry]