LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 12-22-2023, 12:17 AM   #1
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Network Scripts Now On GitHub!


Hi everybody! Merry Christmas or Happy Holidays! I just wanted everyone to know, that I now have posted my set of scripts, just the LINUX side for now. This has been many years of long, hard work as well, and part of the reason I sent it, is so I have a great backup. It's on github.

www.github.com/smileynet000

They are designed for Linux Mint, but they probably work on other Linux systems too. Hopefully, this should explain and show you a bit about how the network stuff fits together, which you, as a community, have helped me work on. Now others can benefit from hard work, which has been put into these! Please review, and tell me what you think! Please tell me what you think of it. I'll keep it open for a bit, while you tell me what you think of it. Thanks!
 
Old 12-22-2023, 12:40 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Thank you, and I wish Merry Christmass to you.
 
Old 12-22-2023, 10:14 PM   #3
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
You're welcome.
 
Old 12-23-2023, 09:58 AM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
You meant to link to https://github.com/smileynet000/network_checks specifically, I guess?

Just looking at basic_internet_check.sh I'd suggest using a function to reduce the duplication a bit, e.g.,

Code:
check() {
    echo "$2"...
    ping -c 4 "$1" > /dev/null
    if [ $? -eq 1 -o $? -eq 2 ]; then
        exit 1
    fi
}

check 192.168.1.11 'Network DNS server'
check 192.168.2.1 'Clientrouter'
check 192.168.2.2 'Clientap'
check 192.168.1.2 'Mainap'
check 192.168.1.1 'Mainrouter'
check 192.168.0.1 'Mainrouter PFSense'
 
Old 12-23-2023, 06:49 PM   #5
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
No. Not just network checks. That's why I posted the generic link. But I was refferring to ANY of my script repos. I'll take that, improvement if it's OK. But the reason, I didn't know to use a function, was I don't really know that part of the language well enough yet. Improvements and "show and tell", is why I put them up there. Is it OK to use the improvements?

Last edited by des_a; 12-23-2023 at 06:49 PM. Reason: Forgot question.
 
Old 12-23-2023, 08:21 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by des_a View Post
No. Not just network checks. That's why I posted the generic link. But I was refferring to ANY of my script repos.
Ah, okay, from the thread title I assumed it was just about the network ones.

Quote:
Is it OK to use the improvements?
Please do.
 
Old 12-24-2023, 11:49 AM   #7
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
They are all origionally designed for my home network. Of course, when I posted them, I hoped that for other people, they would find all kinds of uses as well. More improvements to come after focusing on servers for awhile! There's a bunch of things, like an update system for the network, that I want to implement, as I've done at my Mom's businesses. I can't use exact code, because they are designed for windows. I have to translate it to bash or sh language, as I go, and make other adjustments to it.
 
Old 01-02-2024, 12:36 AM   #8
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
I've implemented the changes, but not proprigated them out yet to github. I'm going to see if I can replace my laptop keyboard before I do that.
 
Old 01-02-2024, 12:37 AM   #9
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
It's also been long enough now, so thanks for those who looked!
 
Old 01-30-2024, 03:11 AM   #10
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
Now, I included copies of a basic, "settings" directory. The settings directory is like a custom /etc, which resides IN /etc. You can, like in all other cases, create a configuration specific to your enviroment. Have fun with my network scripts!
 
1 members found this post helpful.
Old 01-30-2024, 06:28 AM   #11
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,796

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Quote:
Originally Posted by ntubski View Post
...
Code:
check() {
...
        exit 1
...
}
This would exit the shell(-script).
Better just return from the function:
Code:
check() {
...
        return 1
...
}
 
Old 01-30-2024, 08:19 AM   #12
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by MadeInGermany View Post
This would exit the shell(-script).
Better just return from the function:
The original exits from the script when any of the pings fails, so I was trying to replicate that behaviour. I suppose it could also be done with return and then set -e at the top level.
 
1 members found this post helpful.
Old 02-05-2024, 07:30 AM   #13
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
I do like the exit behavior. But that is pretty much why I put it on github. You can always help me with it by trying to come up with a complete patch to suggest, here or back on github. I would evaulate it, and see if I liked it enough to add it. I'm not checking here that often right now, as it's marked solved now, it had been awhile with no replies. And then if you don't like the path I'm taking, but find it useful, you could always fork it. I'm not so unhappy with the code, that I would want to use your fork though, unless it practically writes the moon. From the network script projects, I just wanted to make sure I could share, so I could a) become a better programmer and get more used to github, and b) Be able to have backups in case I lose my work locally, and c) Use the idea from others, that I can store my configuration on github, so others can benefit from it too. With these scripts, I can take Linux Mint, and by running them, have the system back up and running in a day or so, including the install. So things are pretty powerful!
 
Old 02-05-2024, 07:31 AM   #14
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
P.S. - Having the system ready that fast was not possible with windows 10! Part of the reason this works, is the package manager.

Last edited by des_a; 02-05-2024 at 07:31 AM. Reason: Forgot about PM
 
  


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
[SOLVED] Github no binaries /easy downloads without login? Github noob rico001 Linux - Software 4 01-02-2021 07:14 AM
LXer: GitHub Actions moves GitHub into DevOps LXer Syndicated Linux News 0 08-09-2019 01:04 PM
LXer: Learn to use GitHub with GitHub Learning Lab LXer Syndicated Linux News 0 04-20-2018 01:12 AM
LXer: GitHub wants more new contributors, because that's what GitHub is for LXer Syndicated Linux News 0 07-27-2017 06:36 AM

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

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