Tag Archives: bash

Cron Hack running job/script every 5 seconds

what is Cron?

Cron is a time-based job scheduler in Unix-like computer operating systems. ‘cron’ is short for ‘chronograph’.

Cron is the name of a program that enables unix users to execute commands or scripts (groups of commands) automatically at a specified time/date. It is normally used for system admin commands, like makewhatis, which builds a search database for the man -k command, or for running a backup script, but can be used for anything. A common use for it today is connecting to the internet and downloading your email.

Cronjob Hack, running job/script every 5 seconds or something but lesser than a gap of one minute. i made the script to display a log file with time stamp LOGFILE=/root/username/logs/log_`date +%H%M%S`.log so that you can check if your cron is working or not, and you can disable it anytime,

crontab -e

add this on your crontab

*/1 * * * * /scripts/5secondrotatorscript.sh

#! /bin/bash
LOGFILE=/root/username/logs/log_`date +%H%M%S`.log

x=60
while [ ${x} -gt 0 ]
do
/usr/bin/php /home/username/public_html/scripts/file.php >> $LOGFILE
x=$((x-5))
sleep 5
done

save as 5secondrotatorscript.sh