LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2020, 06:37 PM   #1
Newbuilder22
LQ Newbie
 
Registered: Apr 2020
Posts: 3

Rep: Reputation: Disabled
Writing a script for my Synology Disk station to reboot if network lost


Hi
Linux is new to me but I know what I want it to do but can’t speak its language.

At least once a day my Synology Diskstation loses connection and it sends me an email. This however does not reestablish and The only way to get it back online is to reboot,

Having done some reading i don’t know if disabling and re-enacting the network would work.

So In a nutshell I need it to run a script in synology task manager to either reboot or disable and reenable network if connection to outside world is lost.
 
Old 04-13-2020, 10:07 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Welcome to LQ,

Sorry but it's unclear what exactly your question is.
 
Old 04-14-2020, 03:12 AM   #3
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
I'm not sure I understand your question and I know nothing about Synology DiskStation, but judging from their User's Guide there's a restart option inside Synology DiskStation Manager (DSM) (see page 12 of the guide).

On page 7 they also list several online resources like their knowlegde base, their forum, and their technical support page.
 
1 members found this post helpful.
Old 04-14-2020, 03:15 AM   #4
Newbuilder22
LQ Newbie
 
Registered: Apr 2020
Posts: 3

Original Poster
Rep: Reputation: Disabled
I would like to know how to write a script that would restart the network connection if it is lost.

Something like ping 8.8.8.8 every 60 seconds
If no reply then restart the NAS.

I understand that I can do this manually but would like it automated. I have posted on the synology community and not got a reply. I also have emailed support and not heard back.

Thanks for the interest
 
Old 04-14-2020, 04:10 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
First hit on a simple search was this - and I didn't even have synology in the search.
Seems to cover what you want.
 
1 members found this post helpful.
Old 04-14-2020, 05:25 AM   #6
Newbuilder22
LQ Newbie
 
Registered: Apr 2020
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks, when I tried simple search last night no results came up after waiting on the webpage load for 30 mins
 
Old 04-14-2020, 06:58 AM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by Newbuilder22 View Post
I would like to know how to write a script that would restart the network connection if it is lost.

Something like ping 8.8.8.8 every 60 seconds
If no reply then restart the NAS.

I understand that I can do this manually but would like it automated. I have posted on the synology community and not got a reply. I also have emailed support and not heard back.

Thanks for the interest
What script language would you prefer to use?

If bash, one reference I can offer is a link from my signature, Bash Scripting for Dummies and Geniuses. A.k.a. My Bash Blog.

A point I make near the start of that blog is the following:
Quote:
"Whatever you can type on a command line, you can write in a script."
Therefore I recommend that you learn how to write the very basic of a bash script, there are examples in that blog and plenty of examples and guides referenced there or available on the web, and put in the manual instructions you know how to perform.

Following that if you need assistance with making that script run automatically, such as with using cron, we can help you there as well. Please give a script an attempt with whichever language you like best to use.

If you have difficulty with the script, please post what you do have and describe the problems you are having. Please also review that blog for additional debug tactics one can use when writing and debugging bash scripts.
 
Old 04-14-2020, 07:00 AM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by syg00 View Post
First hit on a simple search was this - and I didn't even have synology in the search.
Seems to cover what you want.
Quote:
Originally Posted by Newbuilder22 View Post
Thanks, when I tried simple search last night no results came up after waiting on the webpage load for 30 mins
Also, I can see that you tried web searching, assuming you were searching for something similar to the reference offered by syg00. Did you try to visit the link that they posted? I did and it works and also seems relevant.

Either option is what I'd pursue, writing a script yourself with help from members here, or trying that link+additional searching.
 
Old 04-14-2020, 03:02 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
My thinking.

Log into DS and if not be root.

Create cron script that uses some mechanize to monitor network by some metric then take action such at reboot or telinit.

However all of that seems to me to be useless. I'd fix the reason it is losing "connection." Things like leases, tunnels and unique software from Synology may be the reason.
 
  


Reply



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
HDDs after initialising in Synology not working anymore GPT lost chicken057 Linux - Hardware 7 12-15-2017 03:33 PM
If Known, what are the differences between a Play station 3 and a Play Station 4. Lola Kews General 12 11-18-2013 05:01 PM
Trying to mount single disk from a Raid1 Synology NAS r0k Linux - General 6 05-24-2013 04:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:53 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