shutdown

Linux关机重启注销命令

心不动则不痛 提交于 2019-12-01 08:40:34
关机与重启命令 shutdown shutdown 选项 时间 信息 -r #重启系统 -P #等同于poweroff -H #等同于halt(关闭CPU) -h #关机 -c #取消正在执行的shutdown命令 -k #发送告警信息并拒绝用户登录,但不关机 实际用法 shutdown -h now #现在关机 shutdown -r now #现在重启 reboot reboot 选项 --halt 关闭CPU(同halt)#halt是reboot命令的链接文件 --poweroff (同poweroff)#poweroff也是reboot命令 的链接文件 实际用法 reboot reboot --halt #不常用=halt reboot --poweroff #不常用=poweroff 来源: https://www.cnblogs.com/liy36/p/11673526.html

Python handling system shutdown

夙愿已清 提交于 2019-12-01 08:36:00
问题 I have a multiprocessed python application which is being run as an EXE on windows. Upon selecting to shutdown the operating system the applications throws a number of exceptions as a result of the processes being shutdown. Is there a way to capture the system shutdown request by windows so I may handle the closure of the multiprocesses myself? 回答1: A nabble.com page suggests using win32api.SetConsoleCtrlHandler : “I need to do something when windows shuts down, as when someone presses the

Shutdown Mac Objective C

时间秒杀一切 提交于 2019-12-01 07:35:11
I need to be able to implement methods of: Shutdown Restart Logoff Sleep On a Mac, I am using XCode but can't seem to figure out the code to perform these actions. Can anyone help me out here? Thanks A trivial/lazy way do this is via some simple inline Applescript: NSString *scriptAction = @"restart"; // @"restart"/@"shut down"/@"sleep"/@"log out" NSString *scriptSource = [NSString stringWithFormat:@"tell application \"Finder\" to %@", scriptAction]; NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:scriptSource]; NSDictionary *errDict = nil; if (![appleScript

【转】spring bean 卸载

非 Y 不嫁゛ 提交于 2019-12-01 07:27:41
spring bean 卸载 起因: 群里的一个朋友问到: 关于配置destory-method, springboot中 yml如何指定 首先介绍 bean卸载的三种形式 自定义destory-method 实现 org.springframework.beans.factory.DisposableBean 或者 java.lang.AutoCloseable @Bean 注解时,自动推断. 存在close() 或者 shutdown() 就调用 接下来看一个简单的卸载bean的例子 简单卸载示例 bean实体 public class MyDispose implements Closeable { @Override public void close() throws IOException { System.out.println("MyDispose 执行关闭"); } } applicationContext.xml <bean name="disposeBean" class="com.aya.mapper.model.MyDispose"> </bean> 测试类 @Test public void testApplicationContextGetBean() { ClassPathXmlApplicationContext factory = new

一文教你安全的关闭线程池

雨燕双飞 提交于 2019-12-01 06:40:13
上篇文章 ShutdownHook- Java 优雅停机解决方案 提到应用停机时需要释放资源,关闭连接。对于一些定时任务或者网络请求服务将会使用线程池,当应用停机时需要正确安全的关闭线程池,如果处理不当,可能造成数据丢失,业务请求结果不正确等问题。 关闭线程池我们可以选择什么都不做,JVM 关闭时自然的会清除线程池对象。当然这么做,存在很大的弊端,线程池中正在执行执行的线程以及队列中还未执行任务将会变得极不可控。所以我们需要想办法控制到这些未执行的任务以及正在执行的线程。 线程池 API 提供两个主动关闭的方法 ThreadPoolExecutor#shutdownNow 与 ThreadPoolExecutor#shutdown ,这两个方法都可以用于关闭线程池,但是具体效果却不太一样。 线程池的状态 在说线程池关闭方法之前,我们先了解线程池状态。 线程池状态关系图如下: 从上图我们看到线程池总共存在 5 种状态,分别为: RUNNING :线程池创建之后的初始状态,这种状态下可以执行任务。 SHUTDOWN :该状态下线程池不再接受新任务,但是会将工作队列中的任务执行结束。 STOP : 该状态下线程池不再接受新任务,但是不会处理工作队列中的任务,并且将会中断线程。 TIDYING :该状态下所有任务都已终止,将会执行 terminated() 钩子方法。 TERMINATED

Jetty: Stopping programatically causes “1 threads could not be stopped”

纵饮孤独 提交于 2019-12-01 05:47:59
I have an embedded Jetty 6.1.26 instance. I want to shut it down by HTTP GET sent to /shutdown . So I created a JettyShutdownServlet : @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setStatus(202, "Shutting down."); resp.setContentType("text/plain"); ServletOutputStream os = resp.getOutputStream(); os.println("Shutting down."); os.close(); resp.flushBuffer(); // Stop the server. try { log.info("Shutting down the server..."); server.stop(); } catch (Exception ex) { log.error("Error when stopping Jetty server: "+ex

Prompt user to save when closing app

丶灬走出姿态 提交于 2019-12-01 05:44:30
I'm writing what boils down to a document editor. When the application is closing, I need to prompt the user to save changes. This is easy enough. My question is when is it appropriate to not prompt the user, and instead simply discard unsaved data and close. In the FormClosing event, the CloseReason enum includes: None WindowsShutDown MdiFormClosing UserClosing TaskManagerClosing FormOwnerClosing ApplicationExitCall I figure that WindowsShutDown and TaskManagerClosing should not cause a "save changes?" prompt to appear, to prevent the app from hanging with that prompt showing. Is this

linux学习 - 基本命令篇

纵然是瞬间 提交于 2019-12-01 05:41:09
关机重启命令 基本操作之修改用户名(Ubuntu) 查看系统版本号 查看系统是32位还是64位 系统进程信息查看 查看某个端口被占用的情况 查看磁盘分区使用情况 df 命令 fdisk 关机重启命令 重启命令 reboot shutdown -r now 立刻重启 (root用户使用) shutdown -r 10 过10分钟自动重启 (root用户使用) 关机命令 halt 立刻关机 poweroff 立刻关机 shutdown -h now 立刻关机 (root用户使用) shutdown -h 10 10分钟后自动关机 如果是通过shutdown命令设置关机的话,可以用shutdown -c命令取消 基本操作之修改用户名(Ubuntu) sudo su 转为root用户( 这一步是必须的 ) gedit /etc/passwd,找到你要修改的那一行( 注意不要修改后面的目录 ) gedit /etc/shadow ,找到代表你的那一行,修改用户名为新用户名 gedit /etc/group ,你应该发现你的用户名在很多个组中,全部修改! 修改完,保存,重启。 注意:修改的时候要格外小心,不要打错一个字母。 提示:如果你要修改密码和用户名的话,请先修改密码,重启后,再修改用户名,重启。如果你先修改用户名,再修改密码的话,可能会导致你登录不了Ubuntu。 查看系统版本号 cat

Shutdown Mac Objective C

耗尽温柔 提交于 2019-12-01 04:24:27
问题 I need to be able to implement methods of: Shutdown Restart Logoff Sleep On a Mac, I am using XCode but can't seem to figure out the code to perform these actions. Can anyone help me out here? Thanks 回答1: A trivial/lazy way do this is via some simple inline Applescript: NSString *scriptAction = @"restart"; // @"restart"/@"shut down"/@"sleep"/@"log out" NSString *scriptSource = [NSString stringWithFormat:@"tell application \"Finder\" to %@", scriptAction]; NSAppleScript *appleScript = [

shutdown PC after finishing a script

那年仲夏 提交于 2019-12-01 04:10:17
I'm runnig a script in R that takes many hours. I woud like that my PC automatically shutdown itself after finish my script. Is that possible? How can I do that using R? I've searched for packages and functions for that, but I couldn't find. Thank you P.S. My PC s running Windows 8.1 Max Candocia You can call the cmd prompt directly from R system('shutdown -s') You can view other shutdown commands here: https://stackoverflow.com/a/162305/1362215 . This may be useful if you want to perform other tasks. 来源: https://stackoverflow.com/questions/29761640/shutdown-pc-after-finishing-a-script