Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Dev Section Scripting / API
  • Search

.net core running vesta cli script

Questions regarding the API
Application Programming Interface
Post Reply
  • Print view
Advanced search
1 post • Page 1 of 1
orgolan
Posts: 8
Joined: Sat Apr 25, 2020 7:32 pm

Os: Ubuntu 17x
Web: apache + nginx
.net core running vesta cli script
  • Quote

Post by orgolan » 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:

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");
the test.sh content:

Code: Select all

#! /bin/bash
sudo /usr/local/vesta/bin/v-add-user testuser testpass [email protected] basic
when the code executing i'm catching bash errors and part of them are:

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
how do i solve this?
is it something with dotnet not declared in path thing?
is it shebang line thing?
please help
Top


Post Reply
  • Print view
1 post • Page 1 of 1

Return to “Scripting / API”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password