shutdown

Shutdown MSSQL server from perl script DBI

杀马特。学长 韩版系。学妹 提交于 2019-12-02 09:46:29
I'm writing a perl script in which I've to shutdown my mssql server ,do some operation and then I've to restart it.I know 1 way is to use netstat to stopt the service but I cann't use that. So I tried installing DBI and DBD::ODBC module.I'm able to connect and execute queries by following code use DBI; my $data_source = q/dbi:ODBC:AUTOMATION_WOW64/; my $user = q/pa/; my $password = q/DCE/; # Connect to the data source and get a handle for that connection. my $dbh = DBI->connect($data_source, $user, $password) or die "Can't connect to $data_source: $DBI::errstr"; my $str=$dbh->prepare("select

解决Tomcat无法shutdown进程

天大地大妈咪最大 提交于 2019-12-02 08:35:48
问题分析 这个在windows下没有碰到过,因为此前跑Tomcat都是以服务而不是命令脚本的形式跑的,而且已经换了一个项目,所以暂时不考察windows下是否存在该问题。 难道是Tomcat版本问题?或者用带内存泄漏保护的Tomcat 7可以解决该问题?尝试将web应用跑在apache-tomcat-6.0.18、apache-tomcat-6.0.35、apache-tomcat-7.0.34,发现均存在无法shutdown.sh进程问题。 难道在CentOS(Linux)下,Tomcat无法用shutdown.sh停掉进程?显然不可能的。于是又把web应用从webapps中移走,换回tomcat自带的ROOT,果然启动后再shutdown.sh,查找不到原来的tomcat进程了,也就证明了是自己web应用的问题了。 解决方案 现在已经确定是web应用的问题了,所以可以提解决方案了。 Kill进程,修改tomcat bin目录下shutdown.sh和catalina.sh文件 忽略日志中的严重警告,因为这是关闭tomcat时候引起的,正常情况下不会发生这种内存泄露情况,而且Tomcat6.18以上版本的Tomcat已经做了内存泄露保护,交给Tomcat完成吧,我们只需要在shutdown.sh之后,补上一个kill -9 pid即可。要是嫌这样太麻烦了,可以如下这样改: ===

Code to Restart , Shutdown and enter in to Download Mode for Android Phones?

梦想与她 提交于 2019-12-02 07:18:55
Hi all I am just curious to find out some code that can pro-grammatically REBOOT , SHUTDOWN and enter in to DOWNLOAD MODE mobile phones with. I have been exhausted scouring the internet to find something to do with this but have failed. Does any one have any ideas/links/references ? If your app is signed with the system key, you can use reboot() . On the other hand, if you have root you can still do it (this doesn't work on a few ROMs, mainly a few stock HTC ones. Shutdown: try { Process proc = Runtime.getRuntime() .exec(new String[]{ "su", "-c", "reboot -p" }); proc.waitFor(); } catch

running a program before shutdown in Win7 and Win XP

五迷三道 提交于 2019-12-02 06:14:38
问题 I know that there are threads about this, I found this one: How to schedule a task to run when shutting down windows but it fails for me. I wrote a little program in LabView and made an exe out of it. It runs perfect when I double click the exe in normal windows operation (it takes just a few seconds to complete). Then I put the exe in a batch file and that batch file in the group policy as a shutdown script. The result is that the computer hangs when shuting down. It shows the shutdown

java swing program not closing after dispose is called on last window

风流意气都作罢 提交于 2019-12-02 04:26:59
Preface: This is the first real swing program I have done. I have a swing program, where one JButton is supposed to exit the program. That button triggers this.dispose();. When i click this JButton, it does make the window completely go away, but looking at the debugger, the program itself is still running. My main method only consists of: public static void main (String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new StartupGui().setVisible(true); } }); } My exit button looks like action button looks like: private void exitButtonActionPerformed(java.awt

running a program before shutdown in Win7 and Win XP

谁说我不能喝 提交于 2019-12-02 02:15:15
I know that there are threads about this, I found this one: How to schedule a task to run when shutting down windows but it fails for me. I wrote a little program in LabView and made an exe out of it. It runs perfect when I double click the exe in normal windows operation (it takes just a few seconds to complete). Then I put the exe in a batch file and that batch file in the group policy as a shutdown script. The result is that the computer hangs when shuting down. It shows the shutdown screen for minutes and I have to power cycle the PC to start it again. I even tried only a simple file copy

Remote shutdown PC using C# windows form?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 22:54:39
I'm trying to shutdown PC remotely programmatically using c# via command prompt and I already done a few search and found out this kind of codes. System.Diagnostics.Process.Start("shutdown", "/s"); And since it doesn't spicify any pc which to shutdown so I tried changing that codes to this codes which I think satisfy my goal. But it turns out that this doesn't work. System.Diagnostics.Process.Start("shutdown", "/s /m \\192.168.1.21 /t 5 /c 'Shutdown in 5 seconds'"); NO Exception in C# it just don't shutdown. I also try this but no luck. System.Diagnostics.Process.Start("shutdown /s /m \\192

进程池线程池

≡放荡痞女 提交于 2019-12-01 22:26:55
模块:ThreadPoolExecutor,ProcessPoolExecutor 导入方法: from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor 原理: concurrent.futures是异步调用的机制 模块区分: from multiprocessing import Pool.apply/apply_async 既可同步也可异步 区分: 进程池中进程的数量为计算机核数+1 线程池中线程的数量为计算机核数*5 进程池中的回调函数是父进程调用的,和子进程没有关系 线程池中的回调函数是子线程调用的,和父进程没有关系 模块方法: shutdown() 等效于进程池Pool中的close和join的组合 使用方法: 提交任务用submit 再强调: 如果程序的IO操作比较多,则采用多线程的方式,因为多线程的切换速度比多进程快 如果程序的计算比较多,则采用多进程的方式 小结:针对计算密集的程序来说,Pool或者ProcessPoolExecutor执行效率相当,而ThreadPoolExecutor相对于前两者效率更差 所以当计算密集时使用多进程 #######线程池(进程池)(多任务提交) from concurrent.futures import ThreadPoolExecutor

java_线程池

ぐ巨炮叔叔 提交于 2019-12-01 19:28:16
血一样的教训,今天上午参加了一家现场面试java。在这之前,我一直认为我的java基础还是可以的,而今天一问三不知。现在将面试的问题整理出来 一、说说java中的线程池?   1. 线程池 :线程池是线程的集合,不用自己创建线程,把线程直接给线程池,由线程池处理。 2. 过程 :首先,使用线程池可以重复利用已有的线程继续执行任务,避免线程在创建和销毁时造成的消耗。 其次,由于没有线程创建和销毁时的消耗,可以提高系统响应速度。      最后,通过线程可以对线程进行合理的管理,根据系统的承受能力调整可运行线程数量的大小等。 3. 用线程池的例子: package com.company; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /*线程池*/ public class ThreadPool implements Runnable{ @Override public void run() { System.out.println(Thread.currentThread().getName()); } public static void main(String[] args) { ExecutorService executorService =

linux命令基础认识

旧街凉风 提交于 2019-12-01 19:22:55
开启虚拟机调试网络配置命令 vi /etc/sysconfig/network-scripts/ifcfg-eth0 nmtui (系统图 (编辑)(文件打开路径) 形修改 需先按ESC再按:号 命令) wq (保存修改编辑操作退出)(q(没有修改可以直接推出)!是强制) systemctl restart network ( 系统控制命令, 控制管理服务程序(停止 开启 重启)) ip address show(显示主机IP地址/子网掩码/网关) ip address delete(删除主机IP/子网掩码/网关) net.ifnames=0 biosdevname=0 (修改网卡名 1) 什么是系统命令提示符 说明: 提示管理系统用户什么时候可以输入命令 [root@oldboy69 ~]# ① ② ③ 组成说明: ① 此时登录系统用户名称 ② 设置主机名称信息 ③ 显示所在路径信息 ( ~ )在用户家目录中 2) 命令语法说明 语法规范: 命令 空格 [参数/需求条件] 空格 对象信息(文件/目录) 命令演示: vi -n /etc/hosts ifcfg-eth0 3) 系统目录结构 windows : C:\oldboy\oldboy.txt D:\oldgirl\oldgirl.txt 绝对路径查找数据: 从根开始查找数据信息 linux : /oldboy/oldboy