Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8360421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:27:49+00:00 2026-06-09T11:27:49+00:00

I am working on a cross platform project with c#/soap and php on Windows

  • 0

I am working on a cross platform project with c#/soap and php on Windows and Linux.

The idea is that when the user presses a button on the web interface it sends a soap request which will shutdown the server.

This is working fine on Windows but on Linux its not working, I don’t see any reason why not as when I run the shutdown command manually on the server it works fine.

Below is the code that I am using

public bool shutdownServer()
{
    Process process = new Process();
    if (CommonTasks.getOperatingSystem() == CommonTasks.OperatingSystemType.Windows)
    {
        process.StartInfo.FileName = "shutdown";
        process.StartInfo.Arguments = "-s -t 0";
    }
    else if (CommonTasks.getOperatingSystem() == CommonTasks.OperatingSystemType.Linux)
    {
        process.StartInfo.FileName = "shutdown";
        process.StartInfo.Arguments = "-h now";
    }
    else
    {
        return false;
    }
    library.logging(classDetails + MethodInfo.GetCurrentMethod().Name, string.Format("Shutting down with the following {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments));
    process.Start();
    return true;
}

I can’t see any reason why the linux section won’t perform the shutdown but the windows version works fine. What am I doing wrong.

Just to be clear I am trying to shutdown the entire server, not the application.

Thanks for any help you can provide

*UPDATE *
Thanks for your suggestions, I think I’m getting somewhere. I found out the mono is running under wwwrun using janis method.

I’ve added wwwrun:www group to /etc/groups using wwwrun:x:0, I’m not sure if this is bit is correct or not, I don’t know what the :x:0 is for.

I’ve added %wheel ALL = (ALL) NOPASSWD: /sbin/shutdown to the sudoers file and restart apache.

When I run the soap service to perform the shutdown I get the following error in /var/log/messages

Aug 3 23:28:01 dev-server sudo: pam_unix2(sudo:auth): conversation
failed
Aug 3 23:20:27 dev-server sudo: wwwrun : pam_authenticate:
Conversation error ; TTY=unknown ; PWD=/ ; USER=root ;
COMMAND=/sbin/shutdown -h now

I don’t know where to go from here now, sorry if I’m asking a bit of a noob question, I’m fairly new to soap/linux/mono.

UPDATE 2
Have just found out something else, it works on Windows only if the browser is running on the local PC that is being shutdown. I’ve tried redirecting output from the command to see if it is returning an error and nothing is, so I can’t find out why it is failing.

UPDATE 3
I’ve just found out something else, I have two windows PC, laptop and desktop both Windows 7 x64, from the desktop browser I can do the soap request to shutdown the laptop and visa versa, however, the problem I am having is with Windows Server and Linux, even local on the Windows server browser won’t let me shut itself down via the soap request. Is there a way I can make it so Windows server will allow me to do the shutdown via the soap request, local and remote browser and how can I fix the problem with Linux.

UPDATE 4
Have just fixed the Windows problem, I needed to add the IIS user account as an administrator to allow it to perform the shutdown, so its just Linux I have a problem with now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:27:51+00:00Added an answer on June 9, 2026 at 11:27 am

    I’ve got it solved but all of your suggestions did help especially @janisz and @David Harris.

    In order to get Windows to work I had to add the IIS User (IUSR) to the administrator group on Windows Server 2008.

    For linux I needed to run the command as sudoer as @janisz said. To do this I need to run the command visudo in order to add edit the sudoers file, I then added the following into the sudoers file.

    User_Alias APACHE = wwwrun  
    Cmnd_Alias SHUTDOWN = /sbin/shutdown APACHE
    APACHE ALL = (ALL) NOPASSWD: SHUTDOWN
    

    Then rebooted the server.

    To execute the shutdown command on Windows wasn’t any different as before but on Linux as @David Harris pointed running the command as /sbin/sudo and the arguements /sbin/shutdown -h now

    Thanks for your help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I'm working on a cross-platform project that uses dbus-java, what do I need
I am working on a cross platform OpenGL project and it seems that all
In a cross-platform (Windows, FreeBSD) C++ project I'm working on, I am making use
I'm working on a cross platform project that uses STL. The other compiler includes
I am working with code base that supports both Linux and Windows platform. Now,
I'm working on a cross platform C++ application for Windows, Mac OS X and
I'm working on a cross-platform Firebreath plugin which is crashing on Windows. I use
I am working on a cross platform that needs to use a database to
When working in cross-platform project, most probably you will encounter a lot of #ifdef
I am working on a Cross-Platform open-source project. My application is going to support

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.