Skip to content

Instantly share code, notes, and snippets.

@LeviTaule
Created June 19, 2016 07:22
Show Gist options
  • Save LeviTaule/1feb1e04bbaf45ea7e0cc0daf1f98480 to your computer and use it in GitHub Desktop.
Save LeviTaule/1feb1e04bbaf45ea7e0cc0daf1f98480 to your computer and use it in GitHub Desktop.
Easily alterable cron skeleton with seconds-granularity
#! /bin/sh
# micron.sh - easily alterable cron skeleton with seconds-granularity
# Copyright (c) 2016 Levi Taule
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgement in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
# Usage: ./micron.sh INTERVAL_BETWEEN_EACH_SCRIPT_EXECUTION
# Note that each script will be run SLEEP*number-of-scripts times, not just SLEEP times
# example: ./micron.sh 12
SLEEP=$1
while [ 1 -eq 1 ]
do
echo "Running 1.php"
/usr/bin/php /var/www/html/1.php > /var/www/html/log.txt 2>&1
sleep $SLEEP
echo "Running 2.php"
/usr/bin/php /var/www/html/2.php > /var/www/html/log.txt 2>&1
sleep $SLEEP
echo "Running 3.php"
/usr/bin/php /var/www/html/3.php > /var/www/html/log.txt 2>&1
sleep $SLEEP
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment