您的位置:首页 > 运维架构

Call Unix Script from PeopleCode

2008-08-07 12:29 399 查看
A function to call UNIX and/or shell script from PeopleCode.

/*call unix script from PeopleCode*/

Function CallScript;

/*According to PeopleBooks, PS_HOME is always prefixed to the file location*/

&exitCode = Exec("/path/to/script/scriptname ", True);

End-Function;

The Exec command has changed in PT8.4x so the above function will be:

Function CallScript;

/*Use %Exec_Asynchronous if it is not important to wait for a response from the called script*/

&exitCode = Exec(&PS_HOME | "path/to/script/scriptname", %Exec_Synchronous + %FilePath_Absolute);

If &exitCode <> 0 Then

MessageBox(0, "", 0, 0, ("Script was not Successful! Exit code returned by script was " | &exitCode));

End-If;

End-Function;

If you are using the Exec call inside of an Application Engine and you are calling it in a Synchronous mode, make sure you commit your work before you call it, otherwise, you will get a run time error.

CommitWork();

CallScript();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: