shutdown

Python Save Sets To File On Windows Shutdown?

落爺英雄遲暮 提交于 2019-12-01 11:51:19
问题 I do not want to lose my sets if windows is about to shutdown/restart/log off/sleep, Is it possible to save it before shutdown? Or is there an alternative to save information without worring it will get lost on windows shutdown? JSON, CSV, DB? Anything? s = {1,2,3,4} with open("s.pick","wb") as f: # pickle it to file when PC about to shutdown to save information pickle.dump(s,f) 回答1: you can detect windows shutdown/log off with win32api.setConsoleCtrlHandler there is a good example How To

常用Windows命令、常用 Cmd命令

时光怂恿深爱的人放手 提交于 2019-12-01 11:35:09
常用的Windows 命令使用能够提升工作效率以及快捷处理事项。 下面为平时常用的Windows 命令/cmd 命令。 一、以下命令无需打开cmd 窗口即可操作(输入完毕 打个 回车,即可执行)。 1、部署网站需要经常与IIS打交道:(已安装IIS) (Win + R ) + inetmgr ---快速打开IIS 管理器 (Win + R ) + iisreset ---快速重启IIS 服务 2、开启控制面板 (Win + R ) + control.exe ---打开控制面板(可以输入 control) 3、打开服务/远程/系统日志 (Win + R ) + service.msc ---打开服务 (Win + R ) + mstsc ---打开远程连接(远程连接开启方法见附) (Win + R ) + eventvwr.msc ---打开系统日志(.msc 可省略) 4、打开office com 组件 (Win + R ) + Dcomcnfg ---打开office 64 位 Com 组件 (Win + R ) + comexp.msc -32 ---打开office 32 位 Com 组件(-32 前有空格) 5、打开cmd 命令提示窗 (Win+R)+cmd ---打开命令提示窗 二、以下命令需要打开cmd 命令窗口,执行(执行时,需要回车) 1、电脑开关机命令

Shutdown “worker” go routine after buffer is empty

送分小仙女□ 提交于 2019-12-01 11:25:15
I want my go routine worker ( ProcessToDo() in the code below) to wait until all "queued" work is processed before shutting down. The worker routine has a "to do" channel (buffered), through which work is sent to it. And it has a "done" channel to tell it to start shutdown. The documentation says that the select on the channels will pick a "pseudo-random value" if more than one of the selects are met... which means the shutdown (return) is being triggered before all the buffered work is completed. In the code sample below, I want all 20 messages to print... package main import ( "time" "fmt" )

determine if an application is shutting down normally

我只是一个虾纸丫 提交于 2019-12-01 11:24:30
is there a way to determing if a jvm is shutting down normally? Shutdown hook can only spawn a thread, is there a way to determine if the JVM is existing normally or abnormally at that time? Edwin Dalorzo I remembered a similar question being asked time ago. One possible course of action is the use of SignalHandler . You can read the full article here . It appears to be related to IBM JVM but I think it is equally valid for Java Hotspot. A little-known feature of Java is the ability of an application to install its own signal handler, which is supported through the sun.misc.Signal class.

Linux的操作命令基础

烈酒焚心 提交于 2019-12-01 10:51:24
三Linux的操作命令基础 1.系统操作基础说明 1)什么是系统命令提示符 :提示管理系统用户什么时候可以输入命令 [root@ccl007 ~]# ① ② ③ 组成说明: ① 此时登录系统用户名称 ② 设置主机名称信息 ③ 显示所在路径信息 "~" 表示在用户家目录中 2) 命令语法说明 语法规范: 命令 空格 [参数/需求条件] 空格 对象信息(文件/目录) mikdir -p /ccl/ccl2 3) 系统目录结构 : /ccl/ccl.txt 绝对路径查找数据: 从根开始查找数据信息 相对路径查找数据: 从当前路径开始查找数据信息 2. 系统运行管理命令 shutdown --- 关闭操作系统命令 方法一: 直接输入命令关闭系统 shutdown --- 1分钟后进行关机 方法二: 指定多久时间之后关闭系统 shutdown -h 5 (五分钟后关闭) 方法三: 立即关闭操作系统 shutdown -h 0/now shutdown重启系统+ -r shutdown -r(reboot) 5(五分钟重启) shutdown -r(reboot) 0/now(立即重启) shutdown -c --- 取消关机计划/取消重启计划 3.系统目录相关命令 1) 创建目录信息 mkdir 创建目录命令 mkdir -v 目录创建完毕, 有提示显示 mkdir -p 创建多级目录 2

Shell 编程 编辑工具 awk

China☆狼群 提交于 2019-12-01 10:36:14
本篇主要写一些 shell 脚本编辑工具 awk 的使用。 概述 awk 是一个功能强大的编辑工具,逐行读取输入文本,并根据指定的匹配模式进行查找,对符合条件的内容进行格式化输出或者过滤处理。 awk 倾向于将一行分成多个字段然后再进行处理,且默认情况下字段的分隔符为 空格 或者 tab 键。 awk 执行结果可以通过 print 的功能将字段数据打印显示。 可以使用逻辑操作符 && ,表示 与 , || 表示 或 , ! 表示 非 ;还可以进行简单的数学运算,如 + 、 - 、 * 、 / 、 % 、 ^ 分别表示 加 、 减 、 乘 、 除 、 取余 和 乘方 。 命令常见用法 命令有两种格式: awk [选项] '模式或条件{编辑指令}' 文件 1 文件 2... awk -f 脚本文件 文件 1 文件 2... 常见的内置变量 FS :指定每行文本的字段分隔符,默认为空格或制表位。 NF :当前处理的行的字段个数。 NR :当前处理的行的行号(序数)。 $0 :当前处理的行的整行内容。 $n :当前处理行的第 n 个字段(第 n 列)。 RS :数据记录分隔,默认为 \n ,即每行为一条记录。 FILENAME :被处理的文件名。 示例 按行输出文本 输出所有内容 [root@localhost ~]# awk '{print}' /etc/passwd root:x:0

為{幸葍}努か 提交于 2019-12-01 10:08:21
linux redis 设置密码: 在服务器上,这里以linux服务器为例,为redis配置密码。 1.第一种方式 (当前这种linux配置redis密码的方法是一种临时的,如果redis重启之后密码就会失效,) (1)首先进入redis,如果没有开启redis则需要先开启: [root@iZ94jzcra1hZ bin]# redis-cli -p 6379 127.0.0.1:6379> (2)查看当前redis有没有设置密码: 127.0.0.1:6379> config get requirepass 1) "requirepass" 2) "" (3)为以上显示说明没有密码,那么现在来设置密码: 127.0.0.1:6379> config set requirepass abcdefg OK 127.0.0.1:6379> (4)再次查看当前redis就提示需要密码: 127.0.0.1:6379> config get requirepass (error) NOAUTH Authentication required. 127.0.0.1:6379> 2.第二种方式 (永久方式) 需要永久配置密码的话就去redis.conf的配置文件中找到requirepass这个参数,如下配置: 修改redis.conf配置文件   # requirepass foobared

Linux 系统启动过程

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 09:53:36
linux启动时我们会看到许多启动信息。 Linux系统的启动过程并不是大家想象中的那么复杂,其过程可以分为5个阶段: 内核的引导。 运行 init。 系统初始化。 建立终端 。 用户登录系统。 init程序的类型: SysV: init, CentOS 5之前, 配置文件: /etc/inittab。 Upstart: init,CentOS 6, 配置文件: /etc/inittab, /etc/init/*.conf。 Systemd: systemd, CentOS 7,配置文件: /usr/lib/systemd/system、 /etc/systemd/system。 内核引导 当计算机打开电源后,首先是BIOS开机自检,按照BIOS中设置的启动设备(通常是硬盘)来启动。 操作系统接管硬件以后,首先读入 /boot 目录下的内核文件。 运行init init 进程是系统所有进程的起点,你可以把它比拟成系统所有进程的老祖宗,没有这个进程,系统中任何进程都不会启动。 init 程序首先是需要读取配置文件 /etc/inittab。 运行级别 许多程序需要开机启动。它们在Windows叫做"服务"(service),在Linux就叫做"守护进程"(daemon)。 init进程的一大任务,就是去运行这些开机启动的程序。 但是,不同的场合需要启动不同的程序,比如用作服务器时

Linux命令之关机和重启命令

非 Y 不嫁゛ 提交于 2019-12-01 09:32:26
shutdown:重启或关机 shutdown是一个用来安全关闭或重启linux系统的命令,系统在关闭之前会通知所有登录登录,系统即将关闭。 通常情况下,我们执行的shutdown命令为shutdown -r now或者shutdown -h now。 shutdown常用参数 参数选项 解释说明 -r 重启系统,而不是关机,这个参数在系统重启时经常用到 -h 关机,这个参数在系统关机时经常用到 示例: [root@centos76 ~]# shutdown -h +1 # 一分钟后关闭linux系统 [root@centos76 ~]# shutdown -r 11:00 # 11点整重启linux系统 shutdown命令的工作原理:一旦到了关机时间,shutdown命令就会发送请求给系统的init进程,将系统调整到合适的运行级别,其中0表示关机,6表示重启。所以执行【init 0】表示关机,执行【init 6】表示重启。 来源: https://www.cnblogs.com/zhuzhaoli/p/11675231.html

Shutdown “worker” go routine after buffer is empty

我怕爱的太早我们不能终老 提交于 2019-12-01 08:42:26
问题 I want my go routine worker ( ProcessToDo() in the code below) to wait until all "queued" work is processed before shutting down. The worker routine has a "to do" channel (buffered), through which work is sent to it. And it has a "done" channel to tell it to start shutdown. The documentation says that the select on the channels will pick a "pseudo-random value" if more than one of the selects are met... which means the shutdown (return) is being triggered before all the buffered work is