Skip to content

Instantly share code, notes, and snippets.

@labbots
labbots / split_merge_file.sh
Last active December 22, 2016 16:21
Simple test to check the usage of dd command. This script allows to split a file into chunks and merge them back from chunks to original file using dd command in linux. https://labbots.com/split-and-merge-file-using-dd-command/
#!/bin/bash
#!/bin/bashset -e
PROGNAME=${0##*/}
SHORTOPTS="mbs:d:p:"
LONGOPTS="merge,split,source:,destination:,prefix:"
set -o errexit -o noclobber -o pipefail
OPTS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@" )
eval set -- "$OPTS"
@labbots
labbots / file_cache_clean.sh
Last active December 22, 2016 16:21
Bash script to clean files in directory based on access time and created time. https://labbots.com/delete-stale-files-by-access-time-bash/
#!/bin/bash
#!/bin/bashset -e
# Script to cleanup cache files in file system.
# This script is used to make sure the cache folder does not exceed the set threshold limit in the server.
# The script can be configured as cron job in the server to monitor and delete older files in specified directory.
# The script sends out email if the script cannot bring the directory size below the threshold even after deleting
# files based on min and max access time and created time set in the script.
#
# Usage
@labbots
labbots / ovpn_config_merge_split.sh
Last active May 28, 2022 07:04
Open VPN Config file with inline certificate and keys does not load in network-manager. So here is a simple script to automate the config creation. The script can be used to both merge and split ovpn config files. https://labbots.com/open-vpn-config-file-split-and-merge-bash/
#!/bin/bash
#https://bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/606365
#http://howto.praqma.net/ubuntu/vpn/openvpn-access-server-client-on-ubuntu
#!/bin/bashset -e
function usage(){
echo -e "\nThe script can be used to split or merge ovpn file."