.net core running vesta cli script
Posted: Thu Jun 25, 2020 1:30 pm
hello readers,
i've built .net core website on ubuntu machine.
i have a method for executing bash commands:
example call would be:
the test.sh content:
when the code executing i'm catching bash errors and part of them are:
how do i solve this?
is it something with dotnet not declared in path thing?
is it shebang line thing?
please help
i've built .net core website on ubuntu machine.
i have a method for executing bash commands:
Code: Select all
public static string Bash(string cmd)
{
var escapedArgs = cmd.Replace("\"", "\\\"");
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = "/bin/bash",
Arguments = $"-c \"{escapedArgs}\"",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};
process.Start();
string result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return result;
}
example call would be:
Code: Select all
Bash("/home/admin/test.sh");
Code: Select all
#! /bin/bash
sudo /usr/local/vesta/bin/v-add-user testuser testpass [email protected] basic
Code: Select all
/usr/local/vesta/bin/v-add-user: line 21: /func/main.sh: No such file or directory
/usr/local/vesta/bin/v-add-user: line 22: /conf/vesta.conf: No such file or directory
/usr/local/vesta/bin/v-add-user: line 36: check_args: command not found
/usr/local/vesta/bin/v-add-user: line 37: is_format_valid: command not found
/usr/local/vesta/bin/v-add-user: line 42: is_password_valid: command not found
/usr/local/vesta/bin/v-add-user: line 43: is_package_valid: command not found
is it something with dotnet not declared in path thing?
is it shebang line thing?
please help