restart

Restart Mac OS X ungracefully using a C++ call?

爱⌒轻易说出口 提交于 2019-12-01 13:16:30
问题 How do I restart Mac OS X using C++ ( not Objetive-C ) without invoking any child processes? Don't care if it's ungraceful . system("reboot"); //Is not acceptable as it relies on invoking a process 回答1: I can't think why you wouldn't want to create a new process, but if you really don't want to, then execve("reboot",0,0) will run reboot , replacing the current process. You'll need to include <unistd.h> . I'm assuming this is available on Mac OS; it should be on all POSIX platforms. UPDATE It

Restart ASP.NET application when folder contents change

做~自己de王妃 提交于 2019-12-01 11:21:38
I'm writing a web application that will have "plugins". The plugins will be .DLL files which will export their functionality through predefined interfaces 'n stuff. All the .DLL files are in a folder called "Plugins", and the ASP.NET application loads them all upon startup (by using Assembly.LoadFrom). The problem is that when developing, these plugins will change fairly often (all the functionality is in the plugins, the website itself is just a skeleton). Thus, I need a way to automatically restart the application when the .DLL files change. How do I do that? IF the plugins directory is

How to restart an Activity automatically after it crashes?

夙愿已清 提交于 2019-12-01 10:13:00
问题 Is there a way for me to create a service to track my activity class and restart it after a crash? Note that i CANNOT use uncaughthandlers thread method to restart my app. My app is supposed to crash, don't worry about that part. My app is something simple, like this private class AudioRenderer extends Activity { private MediaPlayer AudioRenderer(String filePath) { File location = new File(filePath); Uri path = Uri.fromFile(location); mp= MediaPlayer.create(this, path); } return mp } Once

how to restart java application, remembering its command line arguments

本秂侑毒 提交于 2019-12-01 05:34:02
问题 I have a java application. It can be started with couple of command line flags. I want to provide ability "restart" the application by user. Currently we save the the arguments on a control file, reads it when restarting the application. What is the best way to restart the application - how can I retain the command line arguments? 回答1: Using the RuntimeMXBean you could retrieve , Classpath, Bootclasspath etc. package com; import java.lang.management.ManagementFactory; import java.lang

tomcat启停脚本

岁酱吖の 提交于 2019-12-01 05:33:54
脚本存放目录 /etc/init.d/ #!/bin/bash # description: Tomcat7 Start Stop Restart # processname: tomcat7 # chkconfig: 234 20 80 CATALINA_HOME=/sdata/software/apache-tomcat-8.5.23 case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) ps -e|grep java|awk '{print "kill -9 "$1}'|sh # sh $CATALINA_HOME/bin/shutdown.sh ;; restart) ps -e|grep java|awk '{print "kill -9 "$1}'|sh sleep 3 # sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; *) echo 'please use : tomcat {start | stop | restart}' ;; esac exit 0 /etc/init.d/tomcat restart 重启 /etc/init.d/tomcat start 启动 /etc/init.d/tomcat

Restart Mysql automatically when ubuntu on EC2 micro instance kills it when running out of memory

淺唱寂寞╮ 提交于 2019-12-01 03:41:30
问题 When the system runs out of memory, ubuntu 12.04 kills the mysql process: Out of memory: Kill process 17074 (mysqld) score 146 or sacrifice child So the process ends up killed. This happens at peaks of server load and mainly because of apache getting wild and eating the remaining available memory. Possible approaches could be: Change somewhere somehow the priority of mysql, so it's not killed (probably a bad fix as something else will be killed) Monitor the status of mysql and restart

Restart app to a certain activity?

醉酒当歌 提交于 2019-12-01 02:33:58
I need to restart my app to a certain activity...is it possible? When I restart it I don't want to start the first activity of application. How can I do this? EDIT : I need to free memory of the app when I restart the app. Lukap In the onCreate method of the activity that is first launched you need to check if you want to go to another activity or not and then where restarted is some condition that check if your app was running before , you can use shared preferences to store some bool value if(restarted){ Intent startActivity = new Intent(); startActivity.setClass(this,OTHER_ACTIVITY.class);

How do I programatically restart a system service(not apache) from apache in linux?

北城余情 提交于 2019-11-30 21:39:34
I need to simple way to allow an end user to restart tomcat from a web page served from apache on the same box. We're trying to make it easy for our QC department to deploy a new version of our webapp to apache. We're using samba, but we need an easy way for them to stop / start the tomcat server before/after the deployment. This would only be for internal qc boxes. Is there an existing solution for this? or would it be easier to write a few quick php application to handle this? Like Skip said, but don't run the CGI as root. Instead, have the CGI call sudo. You can give your web server

Inno Setup conditional restart based on result of executable call

寵の児 提交于 2019-11-30 20:48:08
问题 My Inno Setup script is used to install a driver. It runs my InstallDriver.exe after this file was copied during step ssInstall . I need to ask the user to restart in some cases according to the value returned by InstallDriver.exe . This means that I cannot put InstallDriver.exe in section [Run] because there's no way to monitor it's return value. So I put it in function CurStepChanged() as follows: procedure CurStepChanged(CurStep: TSetupStep); var TmpFileName, ExecStdout, msg: string;