

Nc -z 1234 if ] then echo "Service 1234 is not running on !" fiĮxplanation: nc = netcat, "$?" checks the return code of the "nc" command. Whether you’re a beginner or a more advanced user looking for a memory aid, this cheatsheet will help you remember the basic sed commands. If ] then echo " website is running correcly!" fi Check if a remote service is running correctlyĬan be used in cron like this, sends an email in case of error if you configure option in crontab Kenneth Walker III (RB SEA) Kenneth Walker did a lot of great things last year, he tallied 1,215 yards from scrimmage and nine touchdowns as the focal point of their rushing offense. The Sed Cheatsheet Sed is really a great tool to filter & transform text but the syntax is not always easy. If grep -qs "$MOUNTPOINT" /proc/mounts thenĬan be used in cron like this, sends an email in case of error if you configure option in crontab. Mysql dbname -B -N -s -e "SELECT * FROM tbl" | while read -r line Output file should contain no more than one blank line between lines of text. Deleting $DIRĮcho $DIR seems to be a valid backup: $CHECK sed cheatsheet FILE SPACING: double space a file sed G double space a file which already has blank lines in it. Summary of SN1, SN2, E1, and E2 reactions and synthesis examples. Svnadmin load $REPOSPATH/$f < /tmp/subversion/$f.svn.dumpfileĮcho Directory is only $CHECK. # Echo to stderr function echoerr() ' /my/fileįILES=`find /tmp/subversion -maxdepth 1 -type f -printf %P"\n" | sed 's/.svn.dumpfile//g'`Įcho Loading svn repository /tmp/subversion/$f

Use tee to redirect to a file and stdout:Įcho "foo" | tee /dev/stderr | logger Log bash script output Redirect std and err output to /dev/null: # Activate debugging - echo on, display commands, outputs to stderr! # Ignore nonzero exit value for a command by adding " || true" # Exit script immediately if a command exits with a nonzero exit value
