Skip to content

Arch Server Progress

Chitchat
52 3 9.1k 1
  • So, I know that AI is being used for all sorts of nefarious things out this world, but I also believe there are more people using AI for good that for bad things. One such case in point, I just used Chatgpt to write a bash script so I can check to make sure services are running. And let me tell you, it did a beautiful job!

    I wrote out the following prompt:

    Write a bash script for Arch linux to check if the following services are running:
    
    nginx
    php-fpm
    mariadb
    postfix
    dovecot
    
    For each of the checks, display in the terminal if they are running or stopped
    

    I am sure there are others ways to do this, but it looks like it took it’s queue on my “For each of” and wrote a for each statement. In the prompt in Chatgpt none of the wording is bolded or colored in blue. Which is perfectly fine. I added Redis and UFW to the code in my script file to make sure those are running as well.

    Then Chatgpt told me to make the script executable using chmod +x check_services.sh and to double check to make sure that it chose the correct service names and to use systemctl list-units --type=service to get the exact names of the services and change accordingly.

    So I did that and everything checks out. Then, Chatgpt prompted me and said if you would like to make this color coded let me know. So I did the following prompt:

    This work perfectly. Please include color-coded output

    This was the final code that Chatgpt outputed:

    #!/bin/bash
    
    # Colors
    GREEN="\033[0;32m"
    RED="\033[0;31m"
    NC="\033[0m"  # No Color
    
    # List of services to check
    services=(
      nginx
      php-fpm
      mariadb
      postfix
      dovecot
      redis
      ufw
    )
    
    echo "Checking service statuses..."
    
    # Loop through each service
    for service in "${services[@]}"; do
      status=$(systemctl is-active "$service")
      if [[ "$status" == "active" ]]; then
        echo -e "${service}: ${GREEN}Running ✅${NC}"
      else
        echo -e "${service}: ${RED}Stopped ❌${NC}"
      fi
    done
    

    So upon running this in the terminal when remoted into the server ./checkservices I get the following output:

    b113ad77-bc95-4bf3-90f3-ca22aaa7bcdc-image.png

    I am happy with the results and now have a super easy way to double check and make sure all of the services are running after I reboot the server when a new kernel is installed.

  • So, I know that AI is being used for all sorts of nefarious things out this world, but I also believe there are more people using AI for good that for bad things. One such case in point, I just used Chatgpt to write a bash script so I can check to make sure services are running. And let me tell you, it did a beautiful job!

    I wrote out the following prompt:

    Write a bash script for Arch linux to check if the following services are running:
    
    nginx
    php-fpm
    mariadb
    postfix
    dovecot
    
    For each of the checks, display in the terminal if they are running or stopped
    

    I am sure there are others ways to do this, but it looks like it took it’s queue on my “For each of” and wrote a for each statement. In the prompt in Chatgpt none of the wording is bolded or colored in blue. Which is perfectly fine. I added Redis and UFW to the code in my script file to make sure those are running as well.

    Then Chatgpt told me to make the script executable using chmod +x check_services.sh and to double check to make sure that it chose the correct service names and to use systemctl list-units --type=service to get the exact names of the services and change accordingly.

    So I did that and everything checks out. Then, Chatgpt prompted me and said if you would like to make this color coded let me know. So I did the following prompt:

    This work perfectly. Please include color-coded output

    This was the final code that Chatgpt outputed:

    #!/bin/bash
    
    # Colors
    GREEN="\033[0;32m"
    RED="\033[0;31m"
    NC="\033[0m"  # No Color
    
    # List of services to check
    services=(
      nginx
      php-fpm
      mariadb
      postfix
      dovecot
      redis
      ufw
    )
    
    echo "Checking service statuses..."
    
    # Loop through each service
    for service in "${services[@]}"; do
      status=$(systemctl is-active "$service")
      if [[ "$status" == "active" ]]; then
        echo -e "${service}: ${GREEN}Running ✅${NC}"
      else
        echo -e "${service}: ${RED}Stopped ❌${NC}"
      fi
    done
    

    So upon running this in the terminal when remoted into the server ./checkservices I get the following output:

    b113ad77-bc95-4bf3-90f3-ca22aaa7bcdc-image.png

    I am happy with the results and now have a super easy way to double check and make sure all of the services are running after I reboot the server when a new kernel is installed.

    @Madchatthew Yes, ChatGPT excels in this sense, and does take queues from key items you describe, which sets it apart from others. I actually have a monthly paid subscription to ChatGPT because I use it more frequently these days for something else I have in the pipeline I’m working on.

  • @Madchatthew Yes, ChatGPT excels in this sense, and does take queues from key items you describe, which sets it apart from others. I actually have a monthly paid subscription to ChatGPT because I use it more frequently these days for something else I have in the pipeline I’m working on.

    @phenomlab That is awesome! I think I am going to start using Chatgpt to help with some programming and if nothing else, it should be able to help me understand how to program some things or rather aspects of an app whether web or otherwise.

  • One of the package install options is the AUR. These are programs that can’t be installed using pacman, and are apps that can be installed. Usually the options are to install yay or paru. I am one that doesn’t like extra programs on their computer if I don’t need it. It is another app that can have issues on an upgrade. Of course there is no doubt that typing sudo yay -S google-chrome is way easier and quicker.

    So how do you install from aur.archlinux.org with either of those apps. Easy, lets go through it step by step.

    1. Go to the website aur.archlinux.org

    2. We will use google-chrome for an example. I use chrome off the AUR so that I can log in and have all my bookmarks and extensions sync.

    3. On the page for google-chrome on the AUR there will be a link next to Git Clone URL:.

    4. Click on the link, which is read only to copy the link.
      e6ab2aaa-87bc-4eae-8047-d46dd09a8462-image.png

    5. Go to your terminal and type cd Download - this changes to the Download directory.

    6. Type git clone 'right click and paste here' the link that you clicked on to copy.

    7. Press Enter and now the contents will be downloaded.

    8. Change directory to the new one that appears, which in this case would be google-chrome

    9. Once in this directory, now type makepkg -s -i and it will install after updating packages and compiling. The -s will install missing dependencies and -i will tell makepkg to install after a successful build.

    So now that you have been using good chrome and it says to restart to install the latest update and you do that, but no updates install. That is where you would need to type sudo yay -U google-chrome to upgrade. Or I prefer to do the following.

    1. Go to the Downloads folder then to the program folder that you want to update in the terminal. In this case Downloads/google-chrome

    2. Type git pull

    3. Type makepkg -s -i after git is done pulling down the updates.

    4. Go through the install process after a successful build.

    You will need to put in your password a couple of times and that is normal. Hope this helps and thank you!

  • One of the package install options is the AUR. These are programs that can’t be installed using pacman, and are apps that can be installed. Usually the options are to install yay or paru. I am one that doesn’t like extra programs on their computer if I don’t need it. It is another app that can have issues on an upgrade. Of course there is no doubt that typing sudo yay -S google-chrome is way easier and quicker.

    So how do you install from aur.archlinux.org with either of those apps. Easy, lets go through it step by step.

    1. Go to the website aur.archlinux.org

    2. We will use google-chrome for an example. I use chrome off the AUR so that I can log in and have all my bookmarks and extensions sync.

    3. On the page for google-chrome on the AUR there will be a link next to Git Clone URL:.

    4. Click on the link, which is read only to copy the link.
      e6ab2aaa-87bc-4eae-8047-d46dd09a8462-image.png

    5. Go to your terminal and type cd Download - this changes to the Download directory.

    6. Type git clone 'right click and paste here' the link that you clicked on to copy.

    7. Press Enter and now the contents will be downloaded.

    8. Change directory to the new one that appears, which in this case would be google-chrome

    9. Once in this directory, now type makepkg -s -i and it will install after updating packages and compiling. The -s will install missing dependencies and -i will tell makepkg to install after a successful build.

    So now that you have been using good chrome and it says to restart to install the latest update and you do that, but no updates install. That is where you would need to type sudo yay -U google-chrome to upgrade. Or I prefer to do the following.

    1. Go to the Downloads folder then to the program folder that you want to update in the terminal. In this case Downloads/google-chrome

    2. Type git pull

    3. Type makepkg -s -i after git is done pulling down the updates.

    4. Go through the install process after a successful build.

    You will need to put in your password a couple of times and that is normal. Hope this helps and thank you!

    @Madchatthew Another great guide - thanks.

  • @Madchatthew Another great guide - thanks.

    @phenomlab Thank you! And you are welcome! I had struggled with this the first couple times that google chrome had an update. Then I finally got it that I have to do that each time and that it isn’t done automatically.

  • @phenomlab Thank you! And you are welcome! I had struggled with this the first couple times that google chrome had an update. Then I finally got it that I have to do that each time and that it isn’t done automatically.

    @Madchatthew This is one of the things that I always loathe about unmaintained repositories. They are so easily abandoned these days and it’s often not until the months have gone by where you realise your browser is woefully out of date because the repository no longer has anyone lovingly updating it.

  • @Madchatthew This is one of the things that I always loathe about unmaintained repositories. They are so easily abandoned these days and it’s often not until the months have gone by where you realise your browser is woefully out of date because the repository no longer has anyone lovingly updating it.

    @phenomlab Yeah I am with you there. If they stop maintaining the google chrome one I will have to import my bookmarks and stuff into a different one and switch. I hoping they don’t stop maintaining it though.

    Now some software once it is installed will have an update feature so you don’t have to do that every time, but unfortunately, the google chrome one doesn’t.

  • @phenomlab Yeah I am with you there. If they stop maintaining the google chrome one I will have to import my bookmarks and stuff into a different one and switch. I hoping they don’t stop maintaining it though.

    Now some software once it is installed will have an update feature so you don’t have to do that every time, but unfortunately, the google chrome one doesn’t.

    @Madchatthew said in Arch Server Progress:

    Now some software once it is installed will have an update feature so you don’t have to do that every time, but unfortunately, the google chrome one doesn’t.

    Yes, that was always the case with the Ubuntu repository for Chrome. PITA.

  • @Madchatthew said in Arch Server Progress:

    Now some software once it is installed will have an update feature so you don’t have to do that every time, but unfortunately, the google chrome one doesn’t.

    Yes, that was always the case with the Ubuntu repository for Chrome. PITA.

    @phenomlab said in Arch Server Progress:

    PITA

    LOL yes for sure!!


Related Topics
  • To the Window to the Linux . . .

    Pinned Linux arch linux windows endoflife
    22
    19 Votes
    22 Posts
    2k Views
    @phenomlab said: @Madchatthew ouch. Sounds nasty. Did you get to the bottom of why it happened? I believe it is due to not everything getting upgraded because i wasn’t checking on the different packages I had installed from the AUR. Then when I ran yay it was like, hey would you like to update all of these things that you haven’t updated in months, perhaps years or ever for that matter and I was like yes please If you don’t have yay there are no notifications that you need more updates than what you realize. Chrome was staying updated because it would give me a notification, but there was the nvidia package that needed to be upgraded as well and I had never upgraded it. I didn’t realize it and should have. Then some of those packages use cmake and that needed to be updated as well. So using yay is beneficial to make sure you get all the updates you need.
  • Arch Linux | KDE Plasma Guide

    Moved Guides arch linux kde desktop guide
    3
    1 Votes
    3 Posts
    2k Views
    @phenomlab you are very welcome. I have bookmarks but it is also nice to have this info out there for other people to use as well, and also a place I can go to grab it again if I lose my bookmarks haha
  • Linux on a Stick

    Linux linux usb arch
    29
    16 Votes
    29 Posts
    4k Views
    @DownPW I haven’t tried either of those, I am sure they run fast as well. Linux is so versatile it is awesome!
  • Rename videos in bulk - linux commands

    Unsolved Tips gopro linux commands
    12
    4 Votes
    12 Posts
    2k Views
    @Hari Yes, that’s one (of many) I would recommend. It’s going to be easier to do this under Windows and the fact that you are already connected using SMB is a huge plus.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    4 Posts
    1k Views
    @DownPW most of this really depends on your desired security model. In all cases with firewalls, less is always more, although it’s never as clear cut as that, and there are always bespoke ports you’ll need to open periodically. Heztner’s DDoS protection is superior, and I know they have invested a lot of time, effort, and money into making it extremely effective. However, if you consider that the largest ever DDoS attack hit Cloudflare at 71m rps (and they were able to deflect it), and each attack can last anywhere between 8-24 hours which really depends on how determined the attacker(s) is/are, you can never be fully prepared - nor can you trace it’s true origin. DDoS attacks by their nature (Distributed Denial of Service) are conducted by large numbers of devices whom have become part of a “bot army” - and in most cases, the owners of these devices are blissfully unaware that they have been attacked and are under command and control from a nefarious resource. Given that the attacks originate from multiple sources, this allows the real attacker to observe from a distance whilst concealing their own identity and origin in the process. If you consider the desired effect of DDoS, it is not an attempt to access ports that are typically closed, but to flood (and eventually overwhelm) the target (such as a website) with millions of requests per second in an attempt to force it offline. Victims of DDoS attacks are often financial services for example, with either extortion or financial gain being the primary objective - in other words, pay for the originator to stop the attack. It’s even possible to get DDoS as a service these days - with a credit card, a few clicks of a mouse and a target IP, you can have your own proxy campaign running in minutes which typically involves “booters” or “stressers” - see below for more https://heimdalsecurity.com/blog/ddos-as-a-service-attacks-what-are-they-and-how-do-they-work @DownPW said in Setting for high load and prevent DDoS (sysctl, iptables, crowdsec or other): in short if you have any advice to give to secure the best. It’s not just about DDos or firewalls. There are a number of vulnerabilities on all systems that if not patched, will expose that same system to exploit. One of my favourite online testers which does a lot more than most basic ones is below https://www.immuniweb.com/websec/ I’d start with the findings reported here and use that to branch outwards.
  • Killing Linux Zombie Processes

    Tips zombie linux
    3
    7
    2 Votes
    3 Posts
    1k Views
    @DownPW odd indeed. Looks like it’s spawning, immediately dying, then spawning again.
  • nginx can't start again

    Moved Solved Configure nginx server error
    20
    2 Votes
    20 Posts
    3k Views
    @elhana-fine Yes that will happen of course if you still choose to restart the NGINX service after making a change and the test fails. The test on it’s own will state the error and the line number allowing you to fix that first