Simple one, it monitor regularly the Established connection to file: Continue reading “Monitor TCP Connection in bash regularly”
find files more than specific size
find ./ -size +5G -exec sh -c ‘ls -h “{}”|egrep -i -q “*.(avi|AVI|mkv|MKV|mp4|MP4)$”‘ ‘;’ -print
Log rotation in bash
This is a little bash script that rotate logs as when the file reach a specified limit.
Monitor wlan0 Interface (Wireless) to avoid disconnection from Raspberry Pi
I had implemented my raspberry pi to use wireless network, unfortunately the connection might after a while disconnect, the only option that I have found was to run a script that check the connection and re-connect if network is down.
Continue reading “Monitor wlan0 Interface (Wireless) to avoid disconnection from Raspberry Pi”
removing lines number in bash (using sed)
Working from text files, sometime you might come accross the need to remove the line numbers from line into a file.
cat file_with_line_nbers | sed 's/ *[0-9]*.//' > my_new_file
Sensor CPU check in bash
This script is checking the CPU Temp sensor; If one reach the threshold then a notification or shutdown (if needed) is done.
A few variables required to be set; then you are done
Rename folder by removing 7 first characters in bash
I had the need to remove from several folders that the same level the first 5 characters recursively.
for i in **; do [[ -d "$i" ]] || continue; mv "$i" "$(echo $i | sed -e 's/^.......//')";done
External IP change notification
Having dynamic IP addressing from your Internet Provider (ISP) could give you some trouble; especially when you need to remotely accessing machines;
I had to write a little script that regulary based checks my external IP; And if it change then sending to me an email.
Schedule it into your crontab and you are done.
Below, the script :