reboot

how to do a linux reboot from php file

五迷三道 提交于 2019-11-29 10:56:56
I have a user brftv on my linux system and I have www-data that runs the nginx. from the terminal I can let my brftv user run sudo /sbin/reboot and it works fine since I added the following to my /etc/sudoers file's "#user privilege specification" section: brftv ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff www-data ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff But when my php file runs the following code, nothing happens exec('nohup sudo -u brftv /sbin/reboot'); I added the www-data line to the etc/sudoers above in case it was necessary when running the above exec() (even

Reboot machine from a C#/WPF app

依然范特西╮ 提交于 2019-11-28 21:09:47
I want to have a button in my WPF app that restarts the machine. This app is always running on Vista. The fact that a quick search hasn't turned anything up makes me think this might be harder than I wish it was... any ideas? Thanks! Try this: System.Diagnostics.Process.Start("shutdown.exe", "-r -t 0"); This starts Windows' inbuilt shutdown tool, which can also shut down or logoff a remote or the local machine. Here is the list of full options from ss64.com : Syntax SHUTDOWN [logoff_option] [/m \\Computer] [options] logoff_option: /i Display the GUI (must be the first option) /l Log off. This

How to find the IP address of an amazon EC2 instance on reboot

拜拜、爱过 提交于 2019-11-28 15:35:24
On reboot, the IP address of an amazon instance changes. How to find the new IP address using java API? Assuming you don't want to assign an Elastic IP address (and there are reasons why this is not always a solution) then simply call DescribeInstances on the rebooted instance, which returns a bunch of information including Public IP Address. Here's the AWS EC2 Java API Documentation on the topic. Eric Hammond On reboot, the IP addresses of an EC2 instance do not change. They do generally change on stop/start of a non-VPC EBS boot instance. See my answer to your related question here: https:/

Alarm doesn't trigger after reboot

我们两清 提交于 2019-11-28 08:35:21
问题 I have an alarm to reset a data connection say every 15 minutes. The problem is, once the phone is rebooted, the application gets killed and the alarm (service) doesn't trigger anymore. (This is not a duplicate, the other similar questions on SO do not solve my problem.) <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <receiver android:name="com.sang.mobiledata.ResetBroadcastReceiver" android:exported="false" > <intent-filter> <action android:name="com.sang

Re launch JVM with bigger heap space

不羁的心 提交于 2019-11-28 08:34:50
问题 I want to be able to execute the .Jar file, and if the heap space isn't set big enough, it should launch a new JVM with the same .Jar file, but set with a bigger heap space, and then close the first JVM and .Jar. I've tried using the ProcessBuilder, but I can't get it to work. It has to work cross platform. -ONi 回答1: I have found the solution, and it works cross platform. To restart the JVM from code, use the following. This answer is taken from another question I found after hours of search

Can I get logcat logs after phone reboots?

≡放荡痞女 提交于 2019-11-28 04:33:47
I'm testing an android application with a long running service. I'm using Eclipse and have the usb cord hooked up with the phone sitting next to me. Since it's a long ongoing service, I do some other work while it runs and check the logcat logs every once in a while to make sure everything is going as expected. A few minutes ago I noticed the phone rebooting. I think it's done this before as it would explain some weird application behavior. I quickly switched over to Eclipse to see what happened and found that the logcat log was (it seems) cleared during the reboot. So there's no log of

Android: make notification persist across phone reboot

泄露秘密 提交于 2019-11-28 01:40:13
What's the best way to have a status bar notification persist when the phone is turned off and on again? The only solution I can think of is to create the notification in a Service which starts in response to the BOOT_COMPLETED_ACTION Intent. The only solution I can think of is to create the notification in a Service which starts in response to the BOOT_COMPLETED_ACTION Intent. For raising a Notification , you can probably get by with just doing it in the BOOT_COMPLETED_ACTION BroadcastReceiver , rather than delegating it to a service. However, I agree, this is the only way to do it AFAIK.

Restart android device programmatically

半世苍凉 提交于 2019-11-27 19:53:44
In my android application, I want to restart my android device on button click. But its not working. I have done this so far. ImageButton restartmob = (ImageButton) this.findViewById(R.id.restartmob); restartmob.setOnClickListener(new ImageButton.OnClickListener() { @Override public void onClick(View v) { Process proc = null; try { //proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" }); proc = Runtime.getRuntime().exec(new String[]{"/system/bin/su","-c","reboot now"}); proc.waitFor(); } catch (Exception ex) { Log.i(TAG, "Could not reboot", ex); } } }); Also I put the

How can I get the Windows last reboot reason

蓝咒 提交于 2019-11-27 18:06:05
I'd like to know what is the Windows API function (if any exists) that provides information about the last Windows reboot source. There are three main possible causes: The computer crashed on a blue screen A user or a program shutdown/restarted the computer A power lost The more details I can get the better. However, I need to know at least which reason it is from the main ones. I need to support Windows Vista and Windows 7. Answer: It seems that there is no direct API to get that information. Instead, we have to harvest the Windows Event Log. System reboot information is located in Event

NSUserDefaults losing its keys & values when phone is rebooted but not unlocked

不羁的心 提交于 2019-11-27 16:59:56
We are currently experiencing the following weird issue with our iPhone app. As the title says, NSUserDefaults is losing our custom keys and values when phone is rebooted but not unlocked, and this is happening on a very specific scenario. Context: We are using the NSUserDefaults in the app to store user data (e.g. username). Our app has Location enabled on Background Mode. We are experiencing this issue only when distributing over the air or by Testflight. If I drag and drop the .ipa (same that was distributed over the air) into my phone using Xcode I don't experience this issue. Situation: