New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.. Absent Member..
Absent Member..
1190 views

How do you use ksc_local_exec on Linux?

I have been running ksc_local_exec on our windows box.  I used it ksc_local_exec cmd /c "blah"

 

I thought this would run easier on linux, but I cant seem to get it to work.  I get Cannot run program "if" No such file or directory

How do I need to format the command to run somelike an if statement?

 

ksc_local_exec if [ -e filename ]; then echo "found";fi     

 

Thanks

0 Likes
8 Replies
Highlighted
Absent Member.
Absent Member.

The thing to remember about ksc_local_exec is that it is not the same as a command line with all of the set environment variables, like $PATH, so you would need to specify the full path to any executable that you intend to run.

0 Likes
Highlighted
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Some details about ksc_local_exec

 

This command invokes a local process on the machine running the PPM application server. It can be used to run any program that does not require interactive input. Each call using ‘ksc_local_exec’ is an independent process. It does not execute in the context of other commands that precede it. The starting directory for the processes generated using ‘ksc_local_exec’ is the home directory of the PPM server. Full paths to the executable being called are necessary if the PPM server does not have the correct system path information.

Cheers..
Utkarsh Mishra

-- Remember to give Kudos to answers! (click the KUDOS star)
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

As Utkarsh explained, ksc_local_exec executes a single command. The command it executes can be the sh command and that command should be able to execute the command string you want to execute. We use this to execute the following on AIX. I would expect Linux to behave in a similar manner.

 

ksc_local_exec sh "cd bin;./kRunCacheManager.sh [CACHE_ID]"

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Thanks for the feedback.  I was able to get it working.   One last question about ksc_local_exec.  Is there a way to get the command below to work?  I have tried to escape the space as well as put the statement in quotes.  Nothing seems to work.   The only way I could get it working was to use ksc_begin_script, throw it in there, and then run the script. 

 

ksc_local_exec /bin/rm -f share/oracle/filename.txt

 

rm: illegal option --  Try `rm --help' for more information.

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

We use commands like the following in many command steps. We are running on AIX.

 

ksc_local_exec rm [AS.PKG_TRANSFER_PATH][REQ.REQUEST_ID]query.txt

ksc_local_exec rm -f [P.P_SUB_PATH][P.P_FILENAME]

0 Likes
Highlighted
Commodore Commodore
Commodore

Jim, old thread, but this is exactly what I am trying to do.

I created a report called 'Flush Cache' with a single command shown here:

ksc_local_exec sh "cd bin;./kRunCacheManager.sh [EXEC_PARMS]"

 

But, when I 'create' the report to execute it, I get the following:

 

Source Command:Run CacheManager

sh "cd bin;./kRunCacheManager.sh [EXEC_PARMS]"
sh: SHELLOPTS: readonly variable
sh: cd bin;./kRunCacheManager.sh [EXEC_PARMS]: No such file or directory
exit code = 127
Errors occurred during command execution.

 

Thanks for any help!

Steve

 

Edit: Forgot to mention, this is on a Linux box

0 Likes
Highlighted
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Put cd bin;./kRunCacheManager.sh [EXEC_PARMS] in any script and call it; else use ksc_connect.

 

 

If you just want to flush certain caches then directly call ksc_flush_cache command and the type of caches is defined in /conf/cache.conf

Cheers..
Utkarsh Mishra

-- Remember to give Kudos to answers! (click the KUDOS star)
Highlighted
Commodore Commodore
Commodore

Done - I had figured this out before seeing your response, but we ended up with the same solution - thanks for taking the time to respond!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.