Run a cron job every x seconds
by Andrew on Jan.26, 2010, under Linux
As most of you know, the smallest time a cron job can be configured to run is every minute.
To run a script every 15 seconds for example, you could use the following:
main cron job:
* * * * * /path/to/wrapper.sh
wrapper.sh:
/path/to/script & sleep 15 /path/to/script & sleep 15 /path/to/script & sleep 15 /path/to/script &
If you can suggest any nicer alternatives to this example, please let me know.
Leave a Comment
Can’t create table – errno: 13
by Andrew on Dec.30, 2009, under Linux, MySQL, SQL
I came across a problem today when trying to create a temporary table in MySQL.
ERROR 1005 (HY000): Can't create table 'temptable' (errno: 13)
The first thing I checked was that the user in question had the Create_tmp_table_priv privilege in the users table, which it did.
The next step was to find out where MySQL was writing the temporary tables.
The following command tells us this:
show variables like '%dir'; +---------------------------+----------------------------+ | Variable_name | Value | +---------------------------+----------------------------+ | basedir | /usr/ | | bdb_logdir | | | bdb_tmpdir | /tmp/ | | character_sets_dir | /usr/share/mysql/charsets/ | | datadir | /var/lib/mysql/ | | innodb_data_home_dir | | | innodb_log_arch_dir | | | innodb_log_group_home_dir | ./ | | slave_load_tmpdir | /tmp/ | | tmpdir | /tmp/ | +---------------------------+----------------------------+
And from that we see the tmpdir is located in /tmp/.
A quick checked revealed that MySQL could not create files in this directory, no write access, so a simple permissions change and all was well again.
1 Comment