How to force computer not to restart - scripting

I am writing batch script to automate the product testing. After product finished installation, I need to force computer NOT to restart.
Is there any way to do that with batch script?
Thank for reading

Try shutdown -a. It will abort the shutdown process.

Related

Sanity Start compiles however localhost:3333 returns nothing

Good day all... I have been having an issue with Sanity for the past 3 days... After running sanity start on my linux vps I get the success message Content Studio successfully compiled! Go to http://localhost:3333 however the link returns nothing - it just loads indefinitely without any error message in my console. I have tried chrome, brave and firefox as well as turning third-party cookies on - I'd appreciate any assistance or ideas as to what the problem may be
If simply re-starting Sanity Studio doesn't work, you might check if there's still a thread running after exiting studio, and if so, terminate the thread and start Studio again.
A simple CLI command that kills the process running on port 3333 is:
lsof -t -i tcp:3333 | xargs kill
I've experienced similar issues with Studio being unresponsive after inadvertently leaving it running when my MBP goes to sleep. When I return, it appears Sanity is still running in the terminal, but there is no browser response and no errors thrown in the terminal.
More resources that might help:
Finding the PID of the process using a specific port?
Find (and kill) process locking port 3000 on Mac

Is there a way to detach running remote ssh script in PyCharm?

I use remote shh interpreter in PyCharm regularly, using the configured deployment. I often run remote programs from PyCharm GUI (using F5 key), that takes hours to complete (e.g. training a deep net). This unfortunately means that any network outage causes running script to exit and I have to run the script over again. Is there a way to detach the running script so it keeps running? In the sense similar to what screen or nohup is doing? I know I can run it in screen manually via ssh, but it is a bit inconvenient.
Ok. I found out that this feature is not implemented yet. There is however a suggested workaround

Reboot computer during automation testing

I'm using SpecFlow with NUnit. Some scenarios require reboot computer in the middle of their running. I did not find any approaches to do it for specified technologies. Is there someone who can help me?
Call a command line command from your code to reboot the system should do it, but it would also kill the test run on that machine, so you would also need to schedule the test run to restart after the reboot.
Windows reboot command:
shutdown /r /t 0
As advised Niels, you can split your tests. And, after test is finished, save data on hard drive, then in next test suite read that data.

Restart casper script on phantom crash

I have a script that crashes after a while. It says: PhantomJS has crashed. Please read the crash reporting guide... Is it possible to restart the script when such a crash happens? I use Windows task scheduler to run the casperjs script.
Best Regards

Raspberry Pi shutdown destroys file system

I trying to write a small c program witch reads out an GPIO pin to shutdown the pi externally. The triggering of the signal is working well. The program is started by LXDE as autostart application. If the program detects the shutdown signal it's performing:
sync();
system("halt");
Why does this program damage my ext4 file system after a couple of reboots. There is no fixed number of reboots necessary to damage the system. I don't see any difference by writing halt to command line. I'm using the newest version of the firmware(last update today) and also the kernel is up to date(last update today).
Does anybody have an good idea about it?
This app is a good idea, i wonder nothing like this is already existing...
I think the problem is the "halt" command.
You shuold use the explicit command "shutdown -h now" instead.
For further reading see Anthony Lawrence