Run a script over SSH on Shortcut app in iOS13

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
marciton
Posts: 22
Joined: 11 Mar 2020, 23:39

Run a script over SSH on Shortcut app in iOS13

Post 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?
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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?
:idea: Please read the FAQ and How to Request Help.
marciton
Posts: 22
Joined: 11 Mar 2020, 23:39

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

Post 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?
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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.
:idea: Please read the FAQ and How to Request Help.
marciton
Posts: 22
Joined: 11 Mar 2020, 23:39

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

Post by marciton »

Thanks that's worked perfectly!

Shortcut is from Apple, a built-in App so asking Apple ... is like not asking.
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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:
:idea: Please read the FAQ and How to Request Help.
marciton
Posts: 22
Joined: 11 Mar 2020, 23:39

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

Post 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?
Post Reply