Does xp_cmdshell access the Linux shell as well as the windows shell as appropriate depending on the base system? If so which linux shell is accessed and does this require configuration? I am attempting to run a privileged linux command (requiring SUDO) from a SQL Anywhere script running in ISQL. I am attempting to determine which version of askpass is required for the SUDO -A environment variable. OpenSuSE 12.3 installs the x11 version by default; it does not work or I have configured it improperly. I am running Gnome and there is a gnome (and kde3 I believe I do not need) version of askpass that could work; I will be trying the gnome version next. I have read the DCX help and there was no discussion of specific linux actions. Thanks asked 05 Oct '13, 11:38 pasha19 |
More research led to an very elegant and workable answer. In xp-cmdshell (I use OpenSuse 12.3 and Gnome) I run the command "gnome-terminal -e {script}.sh" (no quotes). In the .sh file I place the command I want to execute on one line and the command "exit" in a separate line at the end of the script. The result is execution like windows with a terminal console window opening to run the command and closing when done. Leaving out the exit command allows the window to remain open to resolve errors. It requires the user to manually exit the terminal console window. Thanks Mark for heading me down a path that would succeed. answered 26 Oct '13, 12:46 pasha19 2
Keep in mind that as long as the Shell is not finished you have bound a Database Worker with waiting for that task to finish.
(28 Oct '13, 03:28)
Thomas Dueme...
Replies hidden
This is part of a batch load application and not an online transaction -- this should not be an issue.
(28 Oct '13, 11:29)
pasha19
And generally I run with the exit command in the file so it will not hang. I only run without the exit when testing the command in the file and I want to see the result in the terminal window.
(07 Nov '13, 14:31)
pasha19
|
Yes, xp_cmdshell works on all platforms that SQL Anywhere is supported. On Linux and all Unix platforms xp_cmdshell emulates system(3): it spawns /bin/sh (/usr/bin/sh on some platforms) and passes the given command. Note that your xp_cmdshell() request will be executed by the database server not ISQL and therefore xp_cmdshell command will be given the same permissions that are given to the server. Depending how you are running your server (e.g. running as a service / daemon?) the command may not have rights to interact with the terminal or console user - i.e. there may not be an attached TTY. I.e. in your specific case the 'askpass' program may not be able to ask the attached user for their password. answered 07 Oct '13, 09:45 Mark Culp Thanks for the info -- you gave me some ideas to try to make this work. If I understand your comment running a personal server from the desktop may have the better chance to give me the needed access to get a password prompt from the command.
(07 Oct '13, 13:25)
pasha19
|