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 is named mnw. I want whenever my c# application starts, it should execute a part of the mnw script.
If it was written it in the terminal would look like :
cd /etc/init.d
./mnw stop
I want this to happen right at the start of public static void Main(), I've been trying
ProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "/dev/init.d/./mnw", Arguments = "stop", };
Process proc = new Process() { StartInfo = startInfo, };
proc.Start();
but it says that stop is a unexpected argument, any ideas?
FileName = "/dev/init.d/./mnw"should have beenFileName = "/etc/init.d/mnw", but I assume that it's a typo while pasting in this question.ProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "/etc/init.d/mnw stop"};or tryProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "/bin/bash", Arguments = "/etc/init.d/mnw stop", };