I have a unix shell script which needs to run in the middle of a stored procedure process. Is there a way to kick this off and know when it's complete?<br>
Thanks
I am not aware of any such facility available on Sybase. If you get to know it, please mail me at <A HREF="mailto:srajesh@kanbay.com">srajesh@kanbay.com</A>
U could use the extended stored procedure xp_cmdshell 'shellscript.sh', [no_output] to do it if u r using ASE 11.5.x or higher. Assumption is that ur shell script is called 'shellscript.sh' and the user executing the same must also have appropriate user rights on the UNIX environment.
U could trap the return status into a sybase variable as u regularly do with other stored procedures.
Syntax
xp_cmdshell command [, no_output]
Parameters
command - is the operating system command string; maximum length is 255 bytes.
no_output - if specified, suppresses any output from the command.
Silently copies the file named log on the C drive to a file named log.0102 on the A drive.
2.xp_cmdshell 'date'
Executes the operating system's date command and returns the current date as a row of data.
Comments
·xp_cmdshell returns any output, including operating system errors, as rows of text in a single column.
·xp_cmdshell is run from the current directory of the XP Server.
·The width of the column of returned output is 80 characters. The output is not formatted.
·xp_cmdshell cannot perform commands that require interaction with the user, such as "login".
·The user context in which an operating system command is executed via xp_cmdshell is controlled by the value of the xp_cmdshell context configuration parameter. If this parameter is set to 1 (the default), xp_cmdshell restricts permission to users with System Administration privileges at the operating system level. If this parameter is set to 0, xp_cmdshell uses the security context of the operating system account under which Adaptive Server is running. Therefore, using xp_cmdshell with the xp_cmdshell context configuration parameter set to 0, any user can execute operating system commands using the permissions of the account running Adaptive Server. This account may have fewer restrictions than the user's own account.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.