LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 12: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, 03:27 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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 03:32 AM. Reason: try to be more helpful even if op provided no info at all.
 
Old 11-12-2017, 03: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, 03:04 AM   #4
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

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

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

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

All times are GMT -5. The time now is 12:05 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
Open Source Consulting | Domain Registration