sh: del: command not found

666 views
Skip to first unread message

Dhanasekaran Anbalagan

unread,
Mar 24, 2018, 6:21:27 PM3/24/18
to rundeck...@googlegroups.com

Hi Guys,

We are having some issue with script execution in windows node using OpenSSH.

resources.xml

<node name="dvt...@10.10.1.181" description="Microsoft Windows Server 2008 R2 Standard" tags="" hostname="10.10.1.181" osArch="x86_64" osFamily="windows" osName="Microsoft Windows Server 2008 R2 Standard" osVersion="Microsoft Windows Server 2008 R2 Standard" username="dvteam" file-copy-destination-dir="C:/\Users/\dvteam/\temp\/"/>

We are able to execute the local-script file, after the script execution. we are getting this error.

/bin/sh: del: command not found

Note Have verified the file-copy-destination-dir location. I can see the batch file.

C:\Program Files\OpenSSH\home\dvteam\temp>ls -ltr
total 1
-rwx------+ 1 dvteam Domain Users 44 Mar 23 16:54 35-91-dvteam_10.10.1.181-script.bat

look like similar to #812 I am not sure what is the fix went in. ?

My Rundeck detail

  • Rundeck version: 2.10.6-1
  • install type: launcher
  • OS Name/version: CentOS-7
  • DB Type/version: MySQL


-Dhanasekaran.

Did I learn something today? If not, I wasted it.

edu...@rundeck.com

unread,
Mar 30, 2018, 2:45:43 PM3/30/18
to rundeck-discuss

Hi Dhanasekaran,


This behaviour is particular to the OpenSSH server installed in the Windows node. We have tested Cygwin-based OpenSSH server solutions for windows that shared the same behaviour, e.g;


Cygwin,

OpenSSH server for windows


If the windows node attribute is 'osFamily="windows", by default, Rundeck sets the script file extension to ".bat" instead of ".sh" and uses "del" to remove the inline script sent.


The solution for this behavior is :


Remove "osFamily" attribute from the node configuration, please find an updated example of your node configuration below:


<node name="dvt...@10.10.1.181" description="Microsoft Windows Server 2008 R2 Standard" tags="" hostname="10.10.1.181" osArch="x86_64" osName="Microsoft Windows Server 2008 R2 Standard" osVersion="Microsoft Windows Server 2008 R2 Standard" username="dvteam" file-copy-destination-dir="C:/\Users/\dvteam/\temp\/"/>

You can remove this option 'file-copy-destination-dir="C:/\Users/\dvteam/\temp\/"'. By default, the inline script will be copied to the temp folder of your ssh server home folder. E.g  For Cygwin (64bit) default installation, it will be “C:\cygwin64\tmp\”.


Set "File Extension" to ".bat" for the inline script used. This is set under "Advanced" -> "File Extension" for the inline script using the Rundeck GUI.



A caveat of using the above OpenSSH servers is that you won’t be able to run MS-DOS ad-hoc commands from the Rundeck GUI Commands tab.


A better solution, to avoid setting the changes on each Job already configured, is to use the recently provided Microsoft’s Windows-native OpenSSH implementation on your Windows node. This allows you to keep your current node and job configuration natively, but please notice that if you still require a specific temp folder where the script should be copied to, the node resource attribute should be using the windows syntax: 'file-copy-destination= "C:\Users\dvteam\temp\"'. This solution will also allow you to run MS-DOS ad-hoc commands from the Rundeck GUI Commands tab.



Warmest Regards,


Eduardo Carrasco



Reply all
Reply to author
Forward
0 new messages