Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use ksc_local_exec on Linux?

Highlighted
bzdafro
Collector

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

8 REPLIES
Jason Nichols K
Honored Contributor

Re: How do you use ksc_local_exec on Linux?

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.

Utkarsh_Mishra
Honored Contributor

Re: How do you use ksc_local_exec on Linux?

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)
Jim Esler
Honored Contributor

Re: How do you use ksc_local_exec on Linux?

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]"

bzdafro
Collector

Re: How do you use ksc_local_exec on Linux?

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.

Jim Esler
Honored Contributor

Re: How do you use ksc_local_exec on Linux?

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]

skbd
Regular Collector

Re: How do you use ksc_local_exec on Linux?

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

Utkarsh_Mishra
Honored Contributor

Re: How do you use ksc_local_exec on Linux?

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)
skbd
Regular Collector

Re: How do you use ksc_local_exec on Linux?

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!

//Add this to "OnDomLoad" event