LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-25-2024, 06:20 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 594

Rep: Reputation: 10
Post A script to shutdown the system under certain conditions


Hello,
I need a script that shuts down the host when the virtual machine is shut down in VirtualBox.
Any example?

Thank you.
 
Old 04-25-2024, 10:20 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,322

Rep: Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373Reputation: 5373
If the VM can see the host, then I’d have the VM run a command on shutdown. That command would be to shut the host down over SSH.

https://opensource.com/life/16/11/ru...shutdown-linux
 
1 members found this post helpful.
Old 04-25-2024, 04:36 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,127

Rep: Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076
What is the host operating system? What is the operating system of the guest?
 
Old 06-13-2024, 08:50 AM   #4
xlfs-0.2
Member
 
Registered: Oct 2022
Posts: 240

Rep: Reputation: 46
there is support for that in the kernel - called "watchdog"

though there are many ways like simply calling "reset"

there are things you could do in init(1) or systemd(1)

security-wise you only want "root" to have access to binary reboot(1) because a web page could activate it (ie, firefox now "demands" access to system compiler which could run programs since, once they can compile apps on your system? no security period.)
 
Old 07-09-2024, 12:49 AM   #5
Jason.nix
Member
 
Registered: Feb 2023
Posts: 594

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by michaelk View Post
What is the host operating system? What is the operating system of the guest?
Hello,
Thank you so much for your reply.
The host OS is Debian and the guest OS is Windows OS.
 
Old 07-09-2024, 03:20 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,127

Rep: Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076
One method is to use ssh to send a shutdown command from windows with a delay.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
To what extent can an older OS be used safely under certain conditions? bcsm Linux - Security 8 11-04-2021 01:46 PM
LXer: FCC: Open source router software is still legal—under certain conditions LXer Syndicated Linux News 0 09-25-2015 03:52 PM
[SOLVED] write to file under certain conditions progchi Linux - Newbie 3 10-30-2012 10:48 AM
Can't log in to wireless network except under certain(inconvenient) conditions Benjamin Lindley Linux - Wireless Networking 3 12-29-2011 12:22 PM
NFS not mounting at boot under certain conditions. robeph Linux - Networking 3 04-29-2008 08:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration