shutdown

How to shutdown machine from ASP.NET

倾然丶 夕夏残阳落幕 提交于 2019-12-07 10:23:29
问题 I have a machine running Windows Home Server v1 (WHS is based on Windows Server 2003 and is runningh IIS6) and on here I have a restful webservice running which I build in C# VS2008 (dotnet 3.5). From within the webservice I want to be able to; 1 Check that certain windows services are running; 2 Start certain windows services 3 Stop certain windows services 4 Reboot the machine 5 Shutdown the machine For 1-3 then I am using impersonation to elevate the ASPNET user to the local administrator

Prevent Windows 7 Shutdown

筅森魡賤 提交于 2019-12-07 08:07:49
问题 I know that shutdown -a will abort a Windows shutdown, but I need to know if there is anything any where I can check for to see if a shutdown is in progress. Ideally, I'd like a small program like this: import os while True: shuttingDown = <shutdown variable to check> if shuttingDown: os.system("shutdown.exe -a") 回答1: For preventing a Windows shutdown when it is happening, you can react to the WM_QUERYENDSESSION message (don't know if you can do that easily with Python's win32 API but it's

Linux Shutdown with dbus-send

喜欢而已 提交于 2019-12-07 05:13:35
问题 I am writing a Java app to shutdown my Linux box remotely. The desktop app sits and waits for a command to be sent to it. I have tried using "shutdown -h" but this requires sudo privileges and is not an option. I then found a way to shutdown without sudo using the following dbus-send solution: dbus-send --print-reply --system --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown This works fine but I am trying to figure out,

How to stop an OSGI Application from command line

让人想犯罪 __ 提交于 2019-12-07 04:04:05
问题 I do have a running osgi (equinox container) application. It will been started via a bash script. See felix gogo shell java -jar ... _osgi.jar -console 1234 & This all works pretty well and I also can stop it via telnet localhost 1234 <osgi>stop 0 But what I am looking for is how can I embed this into a bash script to stop the osgi application. I already tried this echo stop 0 | telnet localhost 1234 but this doesn't work. So if someone has idea how to put this in a bash script, please let me

Prevent windows Shutdown with CANCEL option C#

青春壹個敷衍的年華 提交于 2019-12-07 00:37:31
I'm trying to include in my Windows Form App a way that when user tries to shutdown windows it opens a dialog box with CANCEL option....that office classic one. In other topics, people describes how to prevent windows shutdown. They use a dialog box for this. It helps but if the user immediately clicks in any option in this box, windows closes the application. You can understand what I'm meaning, doing the following test: In windows Vista or 7 Open Paint, Word or any office soft and begin writing something. Do not save it. Try to shutdown windows and when the classic save dialog box appears

一台机器同时运行两个Tomcat

怎甘沉沦 提交于 2019-12-06 15:53:02
如果不加任何修改,在一台服务器上同时运行两个Tomcat服务显然会发生端口冲突。假设现在已经按照正常的方式安装配置好了第一个Tomcat,第二个如何设置呢?以下是使用Tomcat5.5解压版本所做的实验。 解决办法: 1.解压Tomcat到一个新的目录,比如d:\TomcatServer2; 2.新建一个环境变量CATALINA_HOME2,路径为d:\TomcatServer2; 3.编辑Tomcat/bin/startup.bat和catalina.bat,把CATALINA_HOME全部替换成CATALINA_HOME2; 4.编辑Tomcat/conf/server.xml,把8080和8005,8009端口修改成其他数字,比如9080和9005,9009; 5.运行测试。 (如果是安装版的tomca 就不需要配置环境变量) 相关资料::1 下载 tomcat 的压缩包(不是安装的那种,直接解压缩就能用的) 下载地址: http://tomcat.apache.org/download-55.cgi 下载好的文件名是:apache-tomcat-5.5.23.zip 2 解压缩。我解压缩到了C:\ 分别是C:\apache-tomcat-5.5.23-1,C:\apache-tomcat-5.5.23-2 3 修改任意一个的配置文件 比如apache-tomcat-5.5

Tomcat部署

倾然丶 夕夏残阳落幕 提交于 2019-12-06 15:19:22
阅读目录(Content) Tomcat介绍 JVM介绍 环境准备以及软件选择 查看日志目录 Tomcat在CentOS7启动慢的原因 tomcat 管理功能(测试环境使用) 搭建Jpress Tomcat主配置文件介绍 现在来简化一下我们的访问路径 Tomcat多实例 Tomcat反向代理集群 Tomcat监控 tomcat开启远程监控 Tomcat安全优化 Tomcat性能优化 回到顶部(go to top) Tomcat介绍 Tomcat服务器是一个免费的开放源代码的Web应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP网页的首选。 Tomcat和Nginx、Apache(httpd)、lighttpd等Web服务器一样,具有处理HTML页面的功能,另外它还是一个Servlet和JSP容器,独立的Servlet容器是Tomcat的默认模式。不过,Tomcat处理静态HTML的能力不如Nginx/Apache服务器。 目前Tomcat最新版本为9.0。Java容器还有resin、weblogic等。 Tomcat官网:http://tomcat.apache.org/ 常见的JAVA应用架构模型 tomcat处理JSP动态,还需要nginx处理静态的,要动静分离 JVM是tomcat中的核心 回到顶部(go to top) JVM介绍

Reset a TCP socket connection from application

雨燕双飞 提交于 2019-12-06 13:55:25
问题 How to reset an accept ed socket in application level either with IO::Socket::INET in perl or in C? There is a programm bind ing, listen ing on a TCP port, and accept s a client connection, after that it read s and write s some data. If I simply close or shutdown the socket, TCP layer gracefully terminates (with FIN packet), rather than, I'd generate an RST packet. 回答1: You didn't specify the exact OS you are using. I found that Linux does have an API call which will reset a TCP connection, I

Preventing Exceptions without Stack Frames with Error Exception Handler and Shutdown Sequences

北战南征 提交于 2019-12-06 13:40:39
I've run over a somewhat little problem over the week. The error message upfront this is about: [30-Dec-2012 15:19:32] PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0 I think it is because my error handler (see below for details) is turning any error into an exception. I might should prevent that in case there is no stack frame. Is there an easy way to find out if there is any stack frame or not in PHP? Details: On one of my websites I've got an error handler running that is turning every error into an exception, the common ErrorException to be precise. I

Shutdown Remote Computer in Java- Cannot initiate shutdown but no errors

拈花ヽ惹草 提交于 2019-12-06 12:56:08
I am learning about the Runtime class in java, and am testing the use of command line instructions in it. I am trying to remotely shutdown a computer using Runtime.getRuntime().exec(...); When I run this, there are no errors, but the specified machine does not shut down. I don't know why. Code: import java.io.IOException; class shutdownVirus { public static void main(String[] args) throws IOException { Runtime.getRuntime().exec("shutdown -m \\\\T12-LEOPARDIJ -s -t 10"); } } Any help will be greatly appreciated. Thanks Try Runtime.getRuntime().exec("shutdown -s"); Edited part: Use this.