This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Filename: /local/share/check_mk/agents/custom/linux-reboot/lib/local/600/needs-restarted | |
source /etc/os-release | |
VERSION=$(echo ${VERSION} | awk -F . '{ print $1 }') | |
# RHEL and Derivatives | |
if ([[ $ID_LIKE =~ 'fedora' ]] || [[ $ID =~ 'rhel' ]]) && [[ $VERSION =~ '8' ]]; | |
then | |
# RHEL 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To backup: | |
docker exec -u <your_postgres_user> <postgres_container_name> pg_dump -Fc <database_name_here> > db.dump | |
To drop db (Don't do it on production, for test purpose only!!!): | |
docker exec -u <your_postgres_user> <postgres_container_name> psql -c 'DROP DATABASE <your_db_name>' | |
To restore: | |
docker exec -i -u <your_postgres_user> <postgres_container_name> pg_restore -C -d postgres < db.dump | |
working example for awx postgres database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# excercise01.py | |
from datetime import datetime | |
name = input('What is your name? ') | |
age = int(input('What is your age {}? '.format(name))) | |
year = int(datetime.now().year) # Retrieve current year based on system time | |
copies = int(input('How many lines to print? [default: 1 - Enter to accept]') or 1) # Default lines printed to 1 | |
print(copies * "{0} you will be 100 years old in the year {1}\n".format(name, | |
((year - age) + 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script will install ansible including sshpass for --ask-pass functionality | |
# under cygwin. | |
# Before running this install cygwin and select lynx package to be install. | |
# | |
# Script Starts Here | |
# | |
# | |
# fetch apt-cyg via lynx |