You are not logged in.
I have a number of scripts which are started from a GUI which runs another script to open a terminal and start a process. Under xfce4-terminal 0.8.7.4 (Xfce 4.12) this all works fine but now I've moved to xfce4-terminal 0.8.9.2 (Xfce 4.14) this no longer works. The scripts are written in Regina Rexx and the command looks like this:
ipl_parms = 'sys01 1000 $ 2'
"xfce4-terminal --geometry 81x17-0-25 --hide-menubar --working-directory=/home/user01 -T 'IPL Guest Operating System' -I /home/user01/Tools/images/logos.gif -x /home/user01/Tools/IPL-SystemG" ipl_parms
Interestingly enough they do work in Rexx is tokenised (similar to compiled) and is called slightly differently:
ipl_parms = 'sys01 1000 $ 2'
"xfce4-terminal --geometry 81x17-0-25 --hide-menubar --working-directory=/home/user01 -T 'IPL Guest Operating System' -I /home/user01/Tools/images/logos.gif -x regina -e /home/user01/Tools/IPL-SystemG" ipl_parms
I have tried various different combinations of -x, -e, --command and various other ways of setting the command up but it just doesn't pass the variables to the script, or rather the terminal which has been opened.
Ideas gratefully accepted otherwise I take it that this is a bug in this version of xfce4-terminal.
Seb.
Offline
I do not know much about Regina Rexx, I use similar thing but it is bash script.
This one works for me:
#!/bin/bash
ipl_parms='sys01 1000 $ 2'
xfce4-terminal -x bash -c "echo \"My_command with params $ipl_parms\";sleep 5"
But I call the bash interpreter as you do in your second example...
And to my surprise this script called terminal_test:
#!/bin/bash
ipl_parms='sys01 1000 $ 2'
echo "My_command with params $ipl_parms";sleep 5
can be run with this command:
xfce4-terminal -x terminal_test
so it can start bash interpreter by itself.
In your second example it looks as if you were actually running regina (as interpreter or whatever) and not the script IPL-SystemG itself.
Can be the difference in missing interpreter (as if xfce4-terminal did not know how tu run the script IPL-SystemG)?
Last edited by Signy (2020-10-26 19:44:53)
Offline
Looks like a bug in either the Linux distro or XFCE. On OpenSUSE 15.1 everything works just fine although that has xfce4-terminal 0.8.7.4 (Xfce 4.12) so on OpenSUSE 15.2 which has xfce4-terminal 0.8.9.2 (Xfce 4.14), I downgraded to the 15.1 version and still didn't work. By opening the terminal and then executing regina followed by the command is fine but that only works for tokenised rexx and not just plain text. Further investigation is required...
Offline
Can you please post a piece of the plaintext with regina code?
Maybe your system does not know which interpreter is supposed to be used for running the script...
In my script system knows it from the first line. The problem might be there...
Offline
I don't think it has anything to do with the system not knowing about the interpreter but a change that has come in with either the distro or XFCE. I have these scripts running across multiple systems at different versions and it stops working with the latest version of the distro. The plaintext starts with:
#!/usr/bin/rexx
..
and then has code as in my original post. When I create a compiled version, I just use the plaintext version as source. So if the plaintext version works on older systems but also works on the latest version of the distro but only this particular part where you open an xfce terminal to run a script in using -x and passing variables to it doesn't, then something is wrong there, especially if a compiled version does work.
Offline
So if the plaintext version works on older systems but also works on the latest version of the distro but only this particular part where you open an xfce terminal to run a script in using -x and passing variables to it doesn't, then something is wrong there, especially if a compiled version does work.
Just to be clear, are you saying that if you open a terminal window and run this command (with manually set parameters instead of ipl_parms)
/home/user01/Tools/IPL-SystemG ipl_parms
that this works?
In the second example you posted (which works) you run:
regina -e /home/user01/Tools/IPL-SystemG" ipl_parms
and if params work here, then problem is probably not in params.
I see another difference between your examples - an interpreter is not set in the first, but there is the regina interpreter in the second. That is the reason why I suspect that something is wrong wit the interpreter.
Thank you for posting the magic word #!/usr/bin/rexx. Can you pleas run two commands
which rexx
and
ls -l /usr/bin/rexx
and show results? I want just to be sure that rexx installation is correctly placed...
Offline
You kind of got it right. If I run this on the latest distro:
/home/user01/Tools/iplsysg
Which calls IPL-SystemG like this:
ipl_parms = 'sys01 1000 $ 2'
"xfce4-terminal --geometry 81x17-0-25 --hide-menubar --working-directory=/home/user01 -T 'IPL Guest Operating System' -I /home/user01/Tools/images/logos.gif -x /home/user01/Tools/IPL-SystemG" ipl_parms
Then it fails, this is just the plaintext script. However this works on every other distro that I run, just not the latest.
If I compile it and run:
/home/user01/Tools/iplsysg
Which calls IPL-SystemG like this:
ipl_parms = 'sys01 1000 $ 2'
"xfce4-terminal --geometry 81x17-0-25 --hide-menubar --working-directory=/home/user01 -T 'IPL Guest Operating System' -I /home/user01/Tools/images/logos.gif -x regina -e /home/user01/Tools/IPL-SystemG" ipl_parms
Then it works. Basically running the xfce4-terminal with -x to execute a script within that terminal session and passing parameters to it no longer works.
All my Linux distros have the same version of Regina rexx:
regina: REXX-Regina_3.9.1 5.00 5 Apr 2015 (64 bit)
They all have the same Bash:
GNU bash, version 4.4.23(1)-release (x86_64-suse-linux-gnu)
However there are different version of xfce4-terminal and probably xfce:
xfce4-terminal 0.8.9.2 (Xfce 4.14) (does not work)
xfce4-terminal 0.8.7.4 (Xfce 4.12) (doesn not work on the latest distro but does work on older ones)
So as you can see, it is not down to the interpreter but something else. Either the Linux disribution or XFCE (note, these scripts have been running perfectly fine as plaintext in xfce terminals for a few years now)
Offline
You kind of got it right.
Can you please try to run the three commands I asked you in my previous post and tell me about their results?
Offline
Running:
/home/user01/Tools/IPL-SystemG ipl_parms
with manually set parameters failed as before. By tracing, as I have done previously, I can see that the variables are not being passed to the program.
Running
regina -e /home/user01/Tools/IPL-SystemG ipl_parms
with manually set parameters works, the same as calling it from the originating script.
Which rexx just shows:
/usr/bin/rexx
And listing the directory points to etc/alternatives/rexx which in turn points to /usr/bin/rexx-Regina-REXX
Offline
Running:
/home/user01/Tools/IPL-SystemG ipl_parms
with manually set parameters failed as before. By tracing, as I have done previously, I can see that the variables are not being passed to the program.
Thank you, so the problem might be in running the script itself. So you can run the script istself (without any parameters) and it kind of works (of course not properly - when parameters are missing), but rexx itself is properly called?
Running
regina -e /home/user01/Tools/IPL-SystemG ipl_parms
with manually set parameters works, the same as calling it from the originating script.
That basically means that passing parameters works because you were able to pass parameters to regina executable...
Which rexx just shows:
/usr/bin/rexx
And listing the directory points to etc/alternatives/rexx which in turn points to /usr/bin/rexx-Regina-REXX
Thank you. And what does return this code?
ls -l /usr/bin/rexx-Regina-REXX
I am sorry that I am asking for this basic things but I am trying to make sure that the script interpreter is there...
You can also check just parsing parameters in another interpreter by making a script for example called test_parameters with this inside:
#!/bin/bash
echo "Parameters were: $@"
and after you make it executable and run it like that:
test_params Some parameters
it should reply:
Parameters were: Some parameters
Offline
Okay, running a script:
#!/bin/bash
echo "Parameters were: $@"
And passing parameters works however as I'm actually opening another xfce4-terminal to run this script, a better test is:
xfce4-terminal -e testsh.sh some parameters
That doesn't work because the parameters are not being interpreted by the newly opened terminal:
xfce4-terminal -e testsh.sh some parameters
xfce4-terminal: Unknown option "some"
So there is a problem with either Linux distro or XFCE.
Offline
"-e" assumes that the command is the next string
"-x" executes the remainder of the line
Try using "-x" or encase the -e command in quotes:
xfce4-terminal -H -e "testsh.sh some parameters"
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thank you ToZ, you were quicker than me :-)
That leads me back to my previous question:
darmstadt wrote:Running:
/home/user01/Tools/IPL-SystemG ipl_parms
with manually set parameters failed as before. By tracing, as I have done previously, I can see that the variables are not being passed to the program.
Thank you, so the problem might be in running the script itself. So you can run the script istself (without any parameters) and it kind of works (of course not properly - when parameters are missing), but rexx itself is properly called?
It seems that the problem is not in the opening of new xfce terminal window - when the script is not running properly in manually opened window, there is no surprise that it can not work in a new opened window too.
What about this command in manually opened window with manually written parameters:
/usr/bin/rexx /home/user01/Tools/IPL-SystemG ipl_parms
does it work?
And if it does not work, does it return any error messages?
Last edited by Signy (2020-10-30 11:09:40)
Offline
"-e" assumes that the command is the next string
"-x" executes the remainder of the lineTry using "-x" or encase the -e command in quotes:
xfce4-terminal -H -e "testsh.sh some parameters"
Using -'x' is what I had originally and worked fine on previous versions of the Linux Distro and XFCE but no longer, nor does -'e'. There is no need for '-H' as the terminal opens and a process is run inside of it until it terminates. Using the above commands: '-H -e' and with the script in quotes also fails. A terminal is opened but fails as it cannot find the script, seems that the path is not homoured (I've seen this many times in Ubuntu). By adding the path to the script name we do see the parameters. I'm sorry but this is not a problem with the scripts, nor rexx but a problem with either the underlying Linux or XFCE. If it works with previous versions but has stopped working with the latest version then something has changed with them.
Offline
ToZ wrote:"-e" assumes that the command is the next string
"-x" executes the remainder of the lineTry using "-x" or encase the -e command in quotes:
xfce4-terminal -H -e "testsh.sh some parameters"
Using -'x' is what I had originally and worked fine on previous versions of the Linux Distro and XFCE but no longer, nor does -'e'. There is no need for '-H' as the terminal opens and a process is run inside of it until it terminates. Using the above commands: '-H -e' and with the script in quotes also fails. A terminal is opened but fails as it cannot find the script, seems that the path is not homoured (I've seen this many times in Ubuntu). By adding the path to the script name we do see the parameters.
Great, so I do not see any problems with passing parameters. Well, then the problem must be elsewhere.
I'm sorry but this is not a problem with the scripts, nor rexx but a problem with either the underlying Linux or XFCE. If it works with previous versions but has stopped working with the latest version then something has changed with them.
Yes, something has changed. And because I do not have your system to test some possibilities, the only way how I can help you is asking you tu test some options so I could exclude possible problems and find the real cause of your troubles.
Can you please open a terminal window and run this command (with manually written parameters):
/usr/bin/rexx /home/user01/Tools/IPL-SystemG ipl_parms
- does it work?
And if it does not work, does it return any error messages?
Offline
Yes, something has changed. And because I do not have your system to test some possibilities, the only way how I can help you is asking you tu test some options so I could exclude possible problems and find the real cause of your troubles.
Can you please open a terminal window and run this command (with manually written parameters):
/usr/bin/rexx /home/user01/Tools/IPL-SystemG ipl_parms
- does it work?
And if it does not work, does it return any error messages?
Tried that, doesn't work. I can trace the rexx and see that the variables are not being passed as in the variable list is empty. I also tried calling IPL-SystemG from the originating script like this so that a terminal would be opened and exactly the same. Seems that the variables disappear into the ether somewhere.
Offline
Signy wrote:Can you please open a terminal window and run this command (with manually written parameters):
/usr/bin/rexx /home/user01/Tools/IPL-SystemG ipl_parms
- does it work?
And if it does not work, does it return any error messages?Tried that, doesn't work. I can trace the rexx and see that the variables are not being passed as in the variable list is empty. I also tried calling IPL-SystemG from the originating script like this so that a terminal would be opened and exactly the same. Seems that the variables disappear into the ether somewhere.
Thank you. Short conclusion: this works and parameters are passed to regina:
regina -e /home/user01/Tools/IPL-SystemG ipl_parms
and this runs, but without parameters passed to the script:
/usr/bin/rexx /home/user01/Tools/IPL-SystemG ipl_parms
The first working line suggests that passing parameters itself is OK (otherwise it probably would not work). The same is suggested by the test with testsh.sh script.
I installed regina rexx on my Xubuntu (unfortunately my version REXX-Regina_3.6 5.00 31 Dec 2011 is older version than yours) and created an executable script called test.rexx:
#!/usr/bin/rexx
parse arg input
SAY 'Input parameters were: ' input
and when I run it with your parameters (path to the script is not necessary because I saved it into my ~/bin directory which already is in $PATH variable)
test.rexx sys01 1000 $ 2
it returns
Input parameters were: sys01 1000 $ 2
so it is working for me.
Can you test this script (in manually opened terminal window) in the same way too?
Offline
That works fine, however try this instead:
xfce4-terminal -e test.rexx sys01 1000 $ 2
or:
xfce4-terminal -x test.rexx sys01 1000 $ 2
Which is what I am trying to do and it won't work, at least not on my current system (I tried on an older one and it did)
Offline
Thank you. I tested it with -H (just to be able to see the result before the new opened terminal window is closed) and:
This is supposed not to work (and it does not work):
xfce4-terminal -H -e test.rexx sys01 1000 $ 2
it responses in the original window with this error:
xfce4-terminal: Unknown option "sys01"
Correct and working version with -e parameter (as ToZ mentioned) is:
xfce4-terminal -H -e "test.rexx sys01 1000 $ 2"
and it returns in a newly opened window this:
Input parameters were: sys01 1000 $ 2
Version with -x works for me too:
xfce4-terminal -H -x test.rexx sys01 1000 $ 2
and it returns in a newly opened window this:
Input parameters were: sys01 1000 $ 2
- so it works just fine.
What does following version reply to you?
xfce4-terminal -H -x test.rexx sys01 1000 $ 2
Last edited by Signy (2020-10-30 15:53:35)
Offline
I ran the following tests:
First just the simple Bash script:
./testsh.sh one two three
Parameters were: one two three
xfce4-terminal -e testsh.sh one two three
xfce4-terminal: Unknown option "one"
xfce4-terminal -e testsh.sh "one two three"
xfce4-terminal: Unknown option "one two three"
xfce4-terminal -x testsh.sh one two three
Failed to execute child
Failed to execute child process "testsh.sh" (No such file or directory)
xfce4-terminal -x /home/ibmsys1/testsh.sh one two three
Didn't do anything
xfce4-terminal -H -x /home/ibmsys1/testsh.sh one two three
Terminal opened with following message:
The child process exited normally with status 0. X Do not ask me again. Relaunch
In the terminal (hidden under the above message):
Parameters were: one two three
Then again using a simple Rexx script, the results were the same:
./testrex one two three
Parameters were: one two three
xfce4-terminal -e testrex one two three
xfce4-terminal: Unknown option "one"
xfce4-terminal -e testrex "one two three"
xfce4-terminal: Unknown option "one two three"
xfce4-terminal -x testrex one two three
Failed to execute child
Failed to execute child process "testrex" (No such file or directory)
xfce4-terminal -x /home/ibmsys1/testrex one two three
Didn't do anything
xfce4-terminal -H -x testrex one two three
Failed to execute child
Failed to execute child process "testrex" (No such file or directory)
xfce4-terminal -H -x /home/ibmsys1/testrex one two three
Terminal opened with following message:
The child process exited normally with status 0. X Do not ask me again. Relaunch
In the terminal (hidden under the above message):
Parameters were: one two three
Further testing underway
Offline
Thank you for providing not only tests but also exact results, this is very helpful.
I ran the following tests:
First just the simple Bash script:./testsh.sh one two three Parameters were: one two three
xfce4-terminal -e testsh.sh one two three xfce4-terminal: Unknown option "one"
xfce4-terminal -e testsh.sh "one two three" xfce4-terminal: Unknown option "one two three"
xfce4-terminal -x testsh.sh one two three
Failed to execute child
Failed to execute child process "testsh.sh" (No such file or directory)
Not surprising:
1) If testsh.sh is not in a directory which is in the $PATH variable (which is my case during these tests), you need to add the whole path to the script. Sorry I did not mentioned that.
2) Please remember what ToZ wrote 2020-10-30 12:25:05 about using -e parameter and quotes.
xfce4-terminal -x /home/ibmsys1/testsh.sh one two three
Didn't do anything
Really? I would guess that it opened a terminal window, wrote a piece of text and immediately closed the window.
xfce4-terminal -H -x /home/ibmsys1/testsh.sh one two three
Terminal opened with following message:
The child process exited normally with status 0. X Do not ask me again. RelaunchIn the terminal (hidden under the above message):
Parameters were: one two three
Yes, this is correct - because of -H parameter you can see results of the script before you manually close the opened window. And you can see that the script works and passing parameters is OK.
xfce4-terminal -H -x /home/ibmsys1/testrex one two three
Terminal opened with following message:
The child process exited normally with status 0. X Do not ask me again. RelaunchIn the terminal (hidden under the above message):
Parameters were: one two three
Thank you. This is a proof that passing arguments works even inside a rexx script.
So nothing is wrong with your system nor xfce4-terminal nor rexx itself.
So I prepared a new test, file test3.rexx (I put it into my ~/bin directory which is part of $PATH, so there is no need to write whole path to the script):
#!/usr/bin/rexx
ipl_params = 'sys01 1000 $ 2'
"xfce4-terminal -H -x test.rexx" ipl_params
and result is a newly opened terminal window in which is (bellow the blue message
"The child process exited normally with status 0. X Do not ask me again. Relaunch") text:
Input parameters were: sys01 1000 $ 2
In your case the script should be a bit different:
#!/usr/bin/rexx
ipl_params = 'sys01 1000 $ 2'
"xfce4-terminal -H -x /home/ibmsys1/testrex" ipl_params
Does it work for you?
Offline
I'll try to get more information today but have to roll this stuff out today however I did a couple of extra tests yesterday. On an older system I ran the following:
xfce4-terminal -x /home/ibmsys1/testsh.sh one two three
And this worked perfectly fine as it has been for years. A terminal is opened, the script is executed with parameters and a process is kicked off in that terminal which runs until a stop command is entered (which is why I don't require -H)
I ran this on the new system and it failed so have decided to move to the tokenised (compiled) version which I know works
xfce4-terminal -x regina -e /home/ibmsys1/testsh.sh one two three
When I get some time during the day I'll have some more information ,thanks for your help.
Offline
What about the test from my previous post? Because your test
xfce4-terminal -H -x /home/ibmsys1/testrex one two three
was successful, next step is the one I proposed...
On an older system I ran the following:
xfce4-terminal -x /home/ibmsys1/testsh.sh one two three
And this worked perfectly fine as it has been for years. A terminal is opened, the script is executed with parameters and a process is kicked off in that terminal which runs until a stop command is entered (which is why I don't require -H)
That means that you have changed the script testsh.sh from the simple script from your post 2020-10-30 11:08:36 to something else.
Please do not mix these simple tests with another things - otherwise it would be difficult to recognize where the problem is. If one simple thing is tested and the test is successful, then one possible root of problem can be excluded.
Offline
I did more testing last night but first I thought I would clarify the process behind this. It is a GUI driven application where a user can enter parameters, or defaults are used, these are evaluated by the first script and this then starts a terminal session running the second script using just -x in it. This second script then runs a 3rd party program within the terminal and the terminal stays open as you can enter commands into, some of which are automatically performed by the second script. To close this terminal, the user just enters a quit command which will stop the 3rd party program and anything else.
Now I tested using the original scripts, so the first script looks very similar to this:
#!/usr/bin/rexx
trace i
Say 'Starting testrex1'
ipl_parms = 'VM1 test.profile 1000'
Say 'Calling testrex2 with:' ipl_parms
"xfce4-terminal -x /home/ibmsys1/testrex2" ipl_parms
Exit
And the output from that script looks fine:
./testrex1
3 *-* Say 'Starting testrex1'
>L> "Starting testrex1"
Starting testrex1
4 *-* ipl_parms = 'VM1 test.profile 1000'
>L> "zvm itctest.prof 1000"
5 *-* Say 'Calling testrex2 with:' ipl_parms
>L> "Calling testrex2 with:"
>V> "VM1 test.profile 1000"
>O> "Calling testrex2 with: VM1 test.profile 1000"
Calling testrex2 with: VM1 test.profile 1000
6 *-* "xfce4-terminal -x /home/ibmsys1/testrex2" ipl_paams
>L> "xfce4-terminal -x /home/ibmsys1/testrex2"
>V> "VM1 test.profile 1000"
>O> "xfce4-terminal -x /home/ibmsys1/testrex2 VM1 test.profile 1000"
7 *-* Exit
As can be seen, this calls testrex2 but no terminal is opened so it is not running however the 3rd party program is actually started but this means the user no longer has the ability to communicate with it via the terminal it should be running in.
If, instead, I use -H -x then a terminal is opened, the 3rd party program starts in that terminal but you cannot enter any input into that terminal, it is output only.
#!/usr/bin/rexx
Trace i
Say 'Starting testrex2'
Parse Arg parms
Parse Var parms system profile ipl_addr
Say 'The following parameters were sent:' system profile ipl_addr
"VMStart" profile
Exit
3 *-* Say 'Starting testrex2'
>L> "Starting testrex2"
Starting testrex2
4 *-* Parse Arg parms
>>> "VM1 test.profile 1000"
5 *-* Parse Var parms system profile ipl_addr
>V> "VM1 test.profile 1000"
>>> "VM1"
>>> "test.profile"
>>> "1000"
6 *-* Say 'The following parameters were sent:' system profile ipl_addr
>L> "The following parameters were sent:"
>V> "VM1"
>O> "The following parameters were sent: VM1"
>V> "test.profile"
>O> "The following parameters were sent: VM1 test.profile"
>V> "1000"
>O> "The following parameters were sent: VM1 test.profile 1000"
The following parameters were sent: VM1 test.profile 1000
7 *-* "VMStart" profile
>L> "VMStart"
>V> "test.profile"
>O> "VMStart test.profile"
This however, all works with the Rexx compiled or on older systems just as plain text. As I am upgrading all systems, we will be using the compiled version but it does seem to be strange. I do appreciate all the help you've been giving so far.
Offline
I did more testing last night but first I thought I would clarify the process behind this.
So may I assume that the test proposed in my post from 2020-11-02 10:13:58 was successful and the conclusion is that there is no problem with passing variables?
BTW: it is difficult to help you if my questions remain unanswered so I miss important pieces of information.
As can be seen, this calls testrex2 but no terminal is opened so it is not running however the 3rd party program is actually started but this means the user no longer has the ability to communicate with it via the terminal it should be running in.
I guess that the terminal window is actually opened but immediately closed. At least that is what the next case shows with help of the -H parameter.
If, instead, I use -H -x then a terminal is opened, the 3rd party program starts in that terminal but you cannot enter any input into that terminal, it is output only.
That is very interesting. Lets leave opening a new window for a while and concentrate to the script which calls the 3rd party program.
Thank you for providing the script testrex2. I guess that the 3rd party application is VMStart, so for my testing purposes I changed it to ssh (as an application which needs user input) with necessary input parameter value "openwebif":
#!/usr/bin/rexx
#Trace i
Say 'Starting testrex2'
Parse Arg parms
Parse Var parms system profile ipl_addr
Say 'The following parameters were sent:' system profile ipl_addr
Say 'This is system:' system
Say 'This is profile:' profile
Say 'This is ipl_addr:' ipl_addr
#"VMStart" profile
"ssh" profile
Say 'Finishing script testrex2'
Exit
and I ran it in this way:
testrex2 sys01 openwebif $ 2
And it behaved very well:
$ testrex2 sys01 openwebif $ 2
Starting testrex2
The following parameters were sent: sys01 openwebif $ 2
This is system: sys01
This is profile: openwebif
This is ipl_addr: $ 2
Enter passphrase for key '....':
...
...
$ exit
Connection to XXX.XXX.XXX.XXX closed.
Finishing script testrex2
Everything between "Enter passphrase" and "Connection to XXX.XXX.XXX.XXX closed." was a simulation of your 3rd party program.
So it worked correctly on my system.
If you do the same with your testrex2 (that means to open a terminal window manually and to run testrex2 with manually written parameters, preferably without tracing) what is the response of your system?
Offline
[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 717.07 KiB (Peak: 765.91 KiB) ]