Re: ejecutar procesos en servidor Linux desde la web

"Juan C. Olivares" <[email protected]>
Newsgroups gmane.comp.gnome.mono.hispano
Message-ID <[email protected]>
Hola:

Puedes hacer debug con mdb  o con Mono Develop.

Suerte,

2009/6/16 Fabricio Verduga U. <[email protected]>

> Saludos lista,
> Hace tiempo hice esta misma pregunta y aquí me ayudaron con la solución y
> me
> funcionó lo que en ese tiempo probé, sin embargo ahora que debo retomar y
> culminar el mismo proyecto estoy teniendo ciertos inconvenientes con esta
> situación.
>
> Esta es la función que debería hace la magia de ejecutar un comando en un
> servidor Linux.
> private string ejecutaComando(Page pagina, string str_comando, string
> str_parametros)
> {
>        string str_ejecutaComando;
>        string str_directorio = "/home/usuario/";
>        try
>        {
>                System.Diagnostics.ProcessStartInfo startInfo = new
> System.Diagnostics.ProcessStartInfo();
>
>                startInfo.Arguments = str_parametros;
>                startInfo.FileName = str_comando;
>                startInfo.WorkingDirectory = str_directorio;
>
>                startInfo.UseShellExecute = false;
>                startInfo.ErrorDialog = false;
>                startInfo.CreateNoWindow = true;
>                startInfo.RedirectStandardOutput = true;
>
>                try
>                {
>                        System.Diagnostics.Process proc =
> System.Diagnostics.Process.Start(startInfo);
>                        System.IO.StreamReader sr = proc.StandardOutput;
>                        proc.WaitForExit();
>
>                        str_ejecutaComando = sr.ReadToEnd();
>
>                        sr.Close();
>                }
>                catch { this.showInfo.ShowMessageBox(pagina, "No se ejecutó
> sentencia en servidor"); }
>        }
>        catch { this.showInfo.ShowMessageBox(pagina, "No se pudo ejecutar
> comando en servidor"); }
>
>        return str_ejecutaComando;
> }
>
> Y la llamada es con:
> string str_comandoSH = "mkdir";
> string str_argumentos = " nombre_directorio_a_crear";
> str_ejecucion = this.ejecutaComando(this.Page, str_comandoSH,
> str_argumentos);
>
> El asunto es que no me devuelve nada pero tampoco da error en la ejecución
> del asp.net ni ejecuta la sentencia en el servidor. Alguno tiene una idea
> de
> dónde puedo estar fallando ?? Ahh se me olvidaba, con esto tampoco puedo
> saber si la sentencia tuvo error al ejecutar o no, pues la idea es que si
> el
> servidor linux da error al ejecutar el comando pues ese error debe ser
> devuelto a la aplicación pero no logro conseguir esto.
>
> Disculpen por lo extenso del texto y de antemando gracias por su ayuda !!
>
> -----------------------------------------------
>
>
>
> _______________________________________________
> Mono-hispano mailing list
> [email protected]
> https://listas.hispalinux.es/mailman/listinfo/mono-hispano
>



-- 
Atte,
Juan Cristóbal Olivares
חואנכרי

==============

Renovarse o morir: Mi PC de los sesenta tenía veinte mil militantes. Y mi PC
del siglo XXI tiene cuarenta gigabytes.

_______________________________________________
Mono-hispano mailing list
[email protected]
https://listas.hispalinux.es/mailman/listinfo/mono-hispano
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.