Last active
November 17, 2018 02:37
-
-
Save hamidzr/17cc0520d0ae17812715cf5cc13d075d to your computer and use it in GitHub Desktop.
simple sendmail alternative to catch cron logs
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 | |
# simple sendmail | |
date_str=`date +%y-%m-%d--%H-%M-%S` | |
rand=$((RANDOM % 1000)) | |
hostname=$(hostname | tr '/:' '\057\072') | |
fname=$date_str.$rand.$hostname | |
target_dir=SET_DESIRED_DIR | |
# safety measure: do not overwrite existing mail | |
set -o noclobber | |
cat > $target_dir/$fname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment