在我的 webapp 中,我执行以下操作。我知道它是正确的,因为我尝试了 1)将 start_sz 转储到文本文件 2)su www-data 3)复制/粘贴提取字符串并且它有效。
var start_sz = string.Format(@"bash -c 'ln ""{2}/{0}"" ""{2}/{1}""'", fn, newfn, System.IO.Directory.GetCurrentDirectory());
Process.Start(start_sz);
我得到了下面的例外,所以根据上面的推理,我相信它的说法 bash 找不到。
找不到指定的文件
在 System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo,System.Diagnostics.Process 进程)[0x00000] 在:0
在 System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo,System.Diagnostics.Process 进程)[0x00000] 在:0
在 System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x00000] 在:0
在 System.Diagnostics.Process.Start (System.String 文件名) [0x00000] in :0
在 MySite.QueueManager.MakeLink (System.String fn) [0x00000] in :0
在 MySite.QueueManager.ImageQueue2 () [0x00000] 中:0
在 MySite.QueueManager.ImageQueue () [0x00000] 中:0
那么,我该如何解决这个问题?基本上我需要在运行时在我的 asp.net 应用程序中创建一个硬链接(软链接也可以)。
我想也许我需要完整的 bash 路径,所以我尝试/bin/bash -c
了但是也没有用。