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 | |
# Original: http://bencane.com/2015/09/22/preventing-duplicate-cron-job-executions/ | |
# | |
# This script executes ./cmd_loop.sh and save process ID (PID) in file ./forever.pid. | |
# Everytime it's executed it checks for PID in ./forever.pid and if process is still | |
# running then exists with nonzero code. Otherwise it executes ./cmd_loop.sh. | |
PIDFILE=./forever.pid |
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 | |
/sbin/ip route|awk '/default/ { print $3 }' |
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 | |
# Waits for string $2 to appear in the file $1. | |
# Meanwhile it is printing output of the file $1. | |
# If err or ERR string is find in the file $1 then exits with error code 1. | |
# Example use: | |
# waitforstring /var/log/myapp.log "MongoDB started" | |
function waitforstring { | |
local LAST_LINE=1 | |
local READ_LOG |
NewerOlder