By default with most default cron daemons that I have seen, there is simply no way of telling cron to run right here right now. If you're using anacron, it may be possible I think to run a separate instance in the foreground.
If your scripts aren't running properly then you are not taking into account that
- the script is running as a particular user
- cron has a restricted environment (the most obvious manifestation of this is a different path).
Several environment variables are set
up automatically by the cron(8)
daemon. SHELL is set to /bin/sh, and
LOGNAME and HOME are set from the
/etc/passwd line of the crontab’s
owner. PATH is set to "/usr/bin:/bin".
HOME, SHELL, and PATH may be
overridden by settings in the
crontab; LOGNAME is the user that the
job is running from, and may not be
In general PATH is the biggest problem, so you need to:
- Explicitly set the PATH within the script, while testing, to /usr/bin:/bin. You can do this in bash with export PATH="/usr/bin:/bin"
- Explicitly set the proper PATH you want at the top of the crontab. e.g. PATH="/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin"
If you need to run the script as another user without a shell (e.g. www-data), use sudo:
sudo -u www-data /path/to/crontab-script.sh
The first thing to test before all of that, of course, is that your script actually does what it is supposed to do from the command line. If you can't run it from the command line, it will obviously not work from with cron.