Page 1 of 1

Run a script over SSH on Shortcut app in iOS13

Posted: 30 Mar 2020, 23:42
by marciton
hello
On my Synology I have a simple script called Upt_Wesworld.sh :

Code: Select all

 #!/bin/bash
/usr/local/bin/filebot -rename --format "{n} - {s00e00} - {t}" --lang fr  --db TheTVDB --q 'Westworld' --filter "s==03" /volume2/Downloads/_series/Westworld/season\ 3/*.mkv
When I'm running it from ssh on the Synology it's working

if I want to use the function Run a script over SSH on Shortcut app in iOS13 I've an error 57 "

Code: Select all

/usr/local/bin/filebot: line 67 : java: command not found
I tried a lot of option without any success ... did someone try or have an idea?

Re: Run a script over SSH on Shortcut app in iOS13

Posted: 31 Mar 2020, 06:59
by rednoah
How did you install Java? Did you use our Java Installer package? What does which java say?

What does filebot -script fn:sysinfo say?

Does your iOS app add /usr/local/bin to the $PATH by default, or perhaps remove it by default? What does printenv say?

Re: Run a script over SSH on Shortcut app in iOS13

Posted: 31 Mar 2020, 12:05
by marciton
ok the issue could be with the path:

on SSH from the Mac:

Code: Select all

admin@netshare7:~$ printenv
TERM=xterm-256color
SHELL=/bin/sh
SSH_CLIENT=192.168.10.173 62225 22
SSH_TTY=/dev/pts/4
LC_ALL=en_US.utf8
USER=admin
PAGER=more
MAIL=/var/mail/admin
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/var/packages/Java8/target/j2sdk-image/bin:/var/packages/Java8/target/j2sdk-image/jre/bin
PWD=/var/services/homes/admin
JAVA_HOME=/usr/local/java
LANG=en_US.utf8
SHLVL=1
HOME=/var/services/homes/admin
TERMINFO=/usr/share/terminfo
LOGNAME=admin
CLASSPATH=.:/var/packages/Java8/target/j2sdk-image/jre/lib
SSH_CONNECTION=192.168.10.173 62225 192.168.10.214 22
PGDATA=/var/services/pgsql
_=/bin/printenv
OLDPWD=/

on SSH from the phone:

Code: Select all

SHELL=/bin/sh
SSH_CLIENT=192.168.10.170 60642 22
USER=admin
MAIL=/var/mail/admin
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/volume2/homes/admin
SHLVL=1
HOME=/var/services/homes/admin
LOGNAME=admin
SSH_CONNECTION=192.168.10.170 60642 192.168.10.214 22
_=/usr/bin/printenv


What do you recommend to add on the script?

Re: Run a script over SSH on Shortcut app in iOS13

Posted: 31 Mar 2020, 13:28
by rednoah
You'll need to add /usr/local/bin to your $PATH otherwise it won't find the commands that are linked there:

Code: Select all

export PATH="/usr/local/bin:$PATH"

:idea: You may also want to contact the developers of your iOS app and ask them to make their SSH client behave like any other normal SSH client. It's neglecting to initialize with the user profile.

Re: Run a script over SSH on Shortcut app in iOS13

Posted: 01 Apr 2020, 09:45
by marciton
Thanks that's worked perfectly!

Shortcut is from Apple, a built-in App so asking Apple ... is like not asking.

Re: Run a script over SSH on Shortcut app in iOS13

Posted: 01 Apr 2020, 10:07
by rednoah
marciton wrote: 01 Apr 2020, 09:45 Shortcut is from Apple, a built-in App so asking Apple ... is like not asking.
I once filed a bug report with Apple. They replied 2 years later, and closed it immediately with "can't reproduce" and that was that. :lol:

Re: Run a script over SSH on Shortcut app in iOS13

Posted: 02 Apr 2020, 09:38
by marciton
Now that I have a "simple" version working I'm doing the real scripting part with variable and menu ... and like always it's working from the SSH console but not from the shortcut app.
I creating a log to see what happening but I don't have the "exact" command who it build ... any idea how to have it?