Skip to content

Instantly share code, notes, and snippets.

View strap_lamp7_ssl
set -x
# check hostname
hostname -f
# update and install Apache
yum -y update
yum -y install vim httpd
systemctl restart httpd
# backup of the httpd.conf file
simbalinux / insert only once
Last active Jun 14, 2018
insert only once
View insert only once
grep -q -F 'include "/configs/projectname.conf"' || echo 'include "/configs/projectname.conf"' >>
simbalinux / check_if_installed
Last active Jun 14, 2018
View check_if_installed
if [ $(command -v httpd) ]; then echo 'installed'; else echo 'not installed'; fi
# or
if [ $(which httpd) ]; then echo 'installed'; else echo 'not installed'; fi
simbalinux / append_hostsfile
Last active Jun 14, 2018
append /etc/hosts
View append_hostsfile
grep -q -F ' web1' /etc/hosts || echo ' web1' >> /etc/hosts
simbalinux / append_w_sed
Created Jun 15, 2018
append after a line in a file
View append_w_sed
sed -i '/ServerName CustomLog /var/log/httpd/ combined' ssl.conf
simbalinux / append_to_config
Created Jun 25, 2018
Appending a string to an existing configuration file
View append_to_config
log local0
log local1 debug
maxconn 45000 # Total Max Connections.
nbproc 1 # Number of processing cores."
echo "$global_entry"
grep -qF "$global_entry" "$file" || echo "$global_entry" | sudo tee --append "$file"
simbalinux / check_sites
Created Jun 25, 2018
check uptime of sites
View check_sites
SITESFILE=sites.txt #list the sites you want to monitor in this file
#EMAILS="," #list of email addresses to receive alerts (comma separated)
while read site; do
if [ ! -z "${site}" ]; then
CURL=$(curl -s --head $site)
View socks5proxy
#Create a secure server on your lan e.g. raspi
#invoke the following command from the server you will use as socks5 proxy specify port.
ssh -o ServerAliveInterval=60 -D0.0.0.0:8888 -f -N "host_with_www_connection"
#we have forked a background ssh process creating a socks5 proxy dynamically on ALL interfaces using 8888 on localhost, check with...
netstat -ntlp
#turn on the firewalld service
systemctl status firewalld.service
View load array & a new array
for each in "${files[@]}"; do
echo "$each"
sleep 3
for (( i = 0; i < count; i++ )); do
simbalinux / shell_eval
Last active Jul 12, 2018
CGI program written in shell to evaluate filesystem
View shell_eval
#!/usr/bin/env bash
shopt -s nullglob
exec > /path/to/logfile
# Variables
# Arrays
mapfile -t sql < <(find "$sql_path" -type f -mtime -"$days")