LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-12-2017, 01:15 AM   #1
rajasekaran7
LQ Newbie
 
Registered: Nov 2017
Posts: 2

Rep: Reputation: Disabled
System Shutdown when LAN Interface down.


Dear friends,

I need a simple command for shutting down the computer when my LAN Connection is DOWN (Eg:- if i switch of me router my system should shutdown)

Thank you in Advance.
 
Old 11-12-2017, 04:27 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,997
Blog Entries: 4

Rep: Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683Reputation: 1683
have you tried
Code:
shutdown
???

edit:
note to self:
try to be more helpful even if op provided no info at all.

ok, we need to know your operating system.

the shutdown command is likely a good choice, but you will have to read its man page first and maybe apply a few options:
Code:
man shutdown
edit2:
i literally answered your question, but i suspect you want to somehow automate the process.
how about a simple shell script with an if-then statement?
if interface down; then shutdown
i think you can use the 'ip' command to check if an interface is up or down. but there's probably a dozen other options.

Last edited by ondoho; 11-12-2017 at 04:32 AM. Reason: try to be more helpful even if op provided no info at all.
 
Old 11-12-2017, 04:52 AM   #3
rajasekaran7
LQ Newbie
 
Registered: Nov 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi, Thanks for the replay,.

yes you are right, i want to automate the shutdown process, and my trigger should be eth0 ( if the eth0 is down then i need the trigger the halt command)

Thank you
 
Old 11-15-2017, 04:04 AM   #4
!!!
Member
 
Registered: Jan 2017
Posts: 618

Rep: Reputation: 235Reputation: 235Reputation: 235
Try web-searching, tho I had great difficulty finding the right keywords
https://raspberrypi.stackexchange.co...ethernet-cable
 
Old 11-24-2017, 11:45 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,322

Rep: Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470Reputation: 4470
Quote:
Originally Posted by rajasekaran7 View Post
Hi, Thanks for the replay,.
yes you are right, i want to automate the shutdown process, and my trigger should be eth0 ( if the eth0 is down then i need the trigger the halt command)
Read the "Question Guidelines" link in my posting signature. You don't tell us what version/distro of Linux you're using, so there is little we can tell you. There are some things that can be done with things like NetworkManager/dispatcher.d, an if-down script, etc. You could also just write a bash script to ping a host system every now and then, and shutdown then. But you provide no details.
 
  


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
[SOLVED] system failed to save session at shutdown, but retrieved changes after next shutdown - ?! newbiesforever Linux - General 5 06-09-2016 10:58 PM
[SOLVED] shutdown works, but /lib/systemd/system/shutdown.target does not. kaz2100 Debian 3 08-06-2014 04:28 AM
how can i shutdown the PHYSICAL interface of an ethernet interface markraem Linux - Networking 2 04-12-2007 03:29 PM
shutdown net interface spank Linux - Networking 2 09-27-2005 03:02 AM
LAN interface on Gateway stops being able to send info to LAN intermittantly. BurnFEST Debian 2 11-01-2003 04:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:02 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration