It is a basic need for me to streamline how my work flows in Linux. That’s why automation is my favourite tool for that. And these automation tools I use help me to save time so much.
I make use of a custom bash script to automate my backups. I also use a Python script for deep data cleaning.
Which tools and scripts do you use for automating routine tasks on your Linux to save you time and make your life easier?
Hey @Slys I totally agree that automation can be a lifesaver when it comes to working in Linux. It’s all about making our lives easier, right?
First up, I rely on Cron for scheduling repetitive tasks like regular backups. It’s simple and effective.
Secondly, I’ve got a handy Ansible playbook that helps me automate configuration management across multiple Linux machines. It’s super useful for maintaining consistency.
I have written python scripts and also the ruby and crystal shards for the data automation. In my opinion, if you are working in the linux system then you can automate is much faster in the linux environment such as
$find . -type d -iname {you can give anything} and then execute this with an $($find . -type d -iname {you can give anything}) making an indexed array and then for i in $($find . -type d -iname {you can give anything}) ; do echo $i $i/final_location; done >> shell_backup.sh
Linux service for running scripts on the system startup
Cron for recurring jobs
Console alias for the commands I use very often
Because I create many new servers, I have a bash script on Github Gist that helps me automatize the first installation. When I create a new server, I pull the script with wget and run it.
Here is a simple utility just coded was pushing it for a project but can be used for anything. Adding the support for the hashicorp so that it will formulate the instance and will allow the file migration.
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# Universität Potsdam, Germany
# Author: Gaurav Sablok
# date: 2024-1-13
# a scratch automator for the system as well as the administration of the genomes raw files
# change the number as per your convenience
echo "genome assembly project creation and maintenance"
read -r -p "please provide the name of the project:" project
read -r -p "please provide the system type:" system
read -r -p "please provide the project creation and scratch address:" scratch
if [[ ${project} ]] &&
[[ ${system} == "desktop" ]] &&
[[ ${scratch} ]]
then
for i in {1..8}
do mkdir "${project}"_"$i"
done
for i in "${project}"_*
do echo du -sh "${i}" && mv "$i" "${scratch}"
done
elif [[ ${project} ]] &&
[[ ${system} == "server" ]] &&
[[ ${scratch} ]]
then
read -r -p "please provide the username for the slurm server:" username
read -r -p "please provide the ip address of the server:" address
read -r -p "please provide the path to the scratch:" scratch
read -r -p "please provide the name of the project:" project
ssh "${username}"@"${address}"
cd "${scratch}"
for i in {1..8}
do echo "${project}"_"$i"
done
for i in "${project}"_*
do echo du -sh "${i}" && mv "$i" "${scratch}"
done
else
echo "no option selected"
fi
@hydn thank you and now i am writing a hashicorp instance provider and all of that terraform with shell integration. Provide a list of the IP and the instance name it will formulate a terrraform plus rust program and will make the instance .tf files for the terraform.
I use “sh” and cron where possible with most of my stuff being
done on Unix. AT&T Unix not Linux, although I use Linux. I also
have one off programs for example to paginate output to the screen
under Unix and pwgen to generate random passwords under Unix.