C# execute a terminal command in linux

后端 未结 1 1999
忘掉有多难
忘掉有多难 2021-01-17 23:19

I want my c# application (which I execute on a raspberry pi) to run a bash script whenever it starts..
basically : the script is located in /etc/init.d and

1条回答
  •  花落未央
    2021-01-17 23:52

    I have never used ProcessStartInfo on Mono / Linux, but have you tried calling via bash?

    ProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "/bin/bash", Arguments = "/dev/init.d/mnw stop", }; 
    Process proc = new Process() { StartInfo = startInfo, };
    proc.Start();
    

    Also, there is no issues with the executable bit on mnw?

    0 讨论(0)
提交回复
热议问题