shutdown

Linux关机和重启命令

二次信任 提交于 2019-12-01 18:32:06
在早期的 Linux 系统中,应该尽量使用 shutdown 命令来进行关机和重启。因为在那时的 Linux 中,只有 shutdown 命令在关机或重启之前会正确地中止进程及服务,所以我们一直认为 shutdown 才是最安全的关机与重启命令。 而在现在的系统中,一些其他的命令(如 reboot)也会正确地中止进程及服务,但我们仍建议使用 shutdown 命令来进行关机和重启。 shutdown 命令的基本信息如下。 命令名称:shutdown。 所在路径:/sbin/shutdown。 执行权限:超级用户。 功能描述:关机和重启 命令格式 [root@localhost ~]# shutdown [选项] 时间 [警告信息] 选项: -c:取消已经执行的 shutdown 命令; -h:关机; -r:重启; 【例 1】 重启与定时重启。 先来看看如何使用 shutdown 命令进行重启: [root@localhost ~]# shutdown -r now #重启, now是现在重启的意思 [root@localhost ~]# shutdown -r 05:30 #指定时间重启,但会占用前台终端 [root@localhost ~]# shutdown -r 05:30 & #把定义重启命令放入后台,&是后台的意思 [root@localhost ~]# shutdown

Preventing Windows shut down

放肆的年华 提交于 2019-12-01 17:58:50
To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below: TForm3 = class(TForm) private procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ; message WM_QueryEndSession; end; and the implementation procedure TForm3.WMQueryEndSession(var Msg: TWMQueryEndSession); begin Msg.Result := 0; //so I don't want to shutdown while my program is running end; I compiled it Delphi 5 and Delphi 2010. Both of them detect shutdown. But when I compiled in Delphi 2010; after preventing shutdown my program closes. (PC doesn't shutdown)

Wakanda Server scripted clean shutdown

北城以北 提交于 2019-12-01 17:17:05
问题 What is best practice to perform a clean shutdown of a Wakanda server via OS X shell scripting? This would be with a solution currently loaded and operating. 回答1: The best practice for the upcoming release 1.1.0 : Handle the applicationWillStop event on a service to handle app specific closing logic service wakanda stop for Ubuntu and a normal kill for Mac OS ( kill -9 should always be the last resort after some kind of timeout but this should not be necessary anymore) The best practice for

Preventing Windows shut down

£可爱£侵袭症+ 提交于 2019-12-01 16:39:57
问题 To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below: TForm3 = class(TForm) private procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ; message WM_QueryEndSession; end; and the implementation procedure TForm3.WMQueryEndSession(var Msg: TWMQueryEndSession); begin Msg.Result := 0; //so I don't want to shutdown while my program is running end; I compiled it Delphi 5 and Delphi 2010. Both of them detect shutdown.

When Shutdown Hooks Break Bad

我只是一个虾纸丫 提交于 2019-12-01 15:53:38
If I add a shutdown hook to my Java program's runtime like so: public class MyShutdownHook implements Runnable { @Override public void run() { // Stuff I want executed anytime // the program, Java, or the OS exits normally, // crashes, or terminates unexpectedly for any reason. } } // The in another method... Runtime.getRuntime().addShutdownHook(new MyShutdownHook()); ...then are there ever any situations where that run() method won't execute when the program/Java/OS exits normally, crashes or terminates unexpectedly? If so, what situations would be able to by-pass Runtime 's shutdown hook,

When Shutdown Hooks Break Bad

前提是你 提交于 2019-12-01 14:53:54
问题 If I add a shutdown hook to my Java program's runtime like so: public class MyShutdownHook implements Runnable { @Override public void run() { // Stuff I want executed anytime // the program, Java, or the OS exits normally, // crashes, or terminates unexpectedly for any reason. } } // The in another method... Runtime.getRuntime().addShutdownHook(new MyShutdownHook()); ...then are there ever any situations where that run() method won't execute when the program/Java/OS exits normally, crashes

Linux-基本操作(登入登出,图形化界面,命令行界面)

纵饮孤独 提交于 2019-12-01 13:48:40
命令行界面登录 ( 1 )命令行登录界面   安装好 Centos 后,系统启动默认进入的是图形化界面,可以通过如下命令修改进入命令行界面:    命令行登录:systemctl set-default multi-user.target 然后,重启:输入:shutdown –r now 重启后就进入了命令行界面。 输入用户名和密码,就进入系统中: 上面显示的内容表示为 1 、 CentOS Linux 8 (Core) 表示 Linux 的名称( CentOS )和版本 2 、 Kernel 4.18.0-80.el8.x86_64 on an X86_64 表示内核版本为 4.18.0-80.el8 ,目前这部主机的硬件等级为 X86_64 , Linux 安装在 64 位的 PC 上。 3 、dillon dillon dillon 表示主机名, login 后输入登录账号。 root 账号登录:代表在 linux 下的超级用户,它具有无限的权限,可以对系统进行各种操作。 超级用户登录后,提示符是 “ # ”。其他用户登录后,提示符是“ $ ” 在命令行中,使用命令:su – [user],来切换超级用户与普通用户 l通过pwd来查看不同的路,如下图所示 图形化登录界面 如果从命令行界面登录改为图形化界面登录,需要输入以下命令: 图形化界面登录:systemctl set

redis的集群配置

戏子无情 提交于 2019-12-01 13:16:00
1.在根目录下创建集群测试目录 cluster-learn 2.在cluster-learn下创建 7001,7002,7003,7004,7005,7006目录 3.每个目录下放置一份 redis.conf 文件 4.修改 redis.conf 配置文件 下面是一个做少选项的集群配置文件,以7000文件下的redis.conf举例 port 7000 cluster-enabled yes cluster-config-file nodes.conf cluster-node-timeout 5000 appendonly yes 5.编写 启动redis脚本文件 和 关闭redis脚本文件 脚本放在 cluster-learn 目录下 vim startall.sh cd 7001 redis-server redis.conf cd .. cd 7002 redis-server redis.conf cd .. cd 7003 redis-server redis.conf cd .. cd 7004 redis-server redis.conf cd .. cd 7005 redis-server redis.conf cd .. cd 7006 redis-server redis.conf cd .. vim stopall.sh redis-cli -p 7001

如何停止一个线程池?

て烟熏妆下的殇ゞ 提交于 2019-12-01 12:40:54
Java 并发工具包中 java.util.concurrent.ExecutorService 接口定义了线程池任务提交、获取线程池状态、线程池停止的方法等。 JDK 1.8 中,线程池的停止一般使用 shutdown()、shutdownNow()、shutdown() + awaitTermination(long timeout, TimeUnit unit) 方法。 1、shutdown() 方法源码中解释 * Initiates an orderly shutdown in which previously submitted * tasks are executed, but no new tasks will be accepted. * Invocation has no additional effect if already shut down. 有序关闭,已提交任务继续执行 不接受新任务 2、shutdownNow() 方法源码中解释 * Attempts to stop all actively executing tasks, halts the * processing of waiting tasks, and returns a list of the tasks * that were awaiting execution.

线程池包含哪些状态?

别等时光非礼了梦想. 提交于 2019-12-01 12:40:10
线程池状态: 线程池的5种状态:RUNNING、SHUTDOWN、STOP、TIDYING、TERMINATED。 见 ThreadPoolExecutor 源码 // runState is stored in the high-order bits private static final int RUNNING = -1 << COUNT_BITS; private static final int SHUTDOWN = 0 << COUNT_BITS; private static final int STOP = 1 << COUNT_BITS; private static final int TIDYING = 2 << COUNT_BITS; private static final int TERMINATED = 3 << COUNT_BITS; 1. RUNNING:线程池一旦被创建,就处于 RUNNING 状态,任务数为 0,能够接收新任务,对已排队的任务进行处理。 2. SHUTDOWN:不接收新任务,但能处理已排队的任务。调用线程池的 shutdown() 方法,线程池由 RUNNING 转变为 SHUTDOWN 状态。 3. STOP:不接收新任务,不处理已排队的任务,并且会中断正在处理的任务。调用线程池的 shutdownNow() 方法,线程池由