Where
| created | timestamp | NO | | CURRENT_TIMESTAMP | |
and
<td><? echo date(“d/m/y”,$row['created']); ?></td>
would not work so use
<td><? echo date(“d m y (D)”, strtotime($row['created'])) ?></td>
Where
| created | timestamp | NO | | CURRENT_TIMESTAMP | |
and
<td><? echo date(“d/m/y”,$row['created']); ?></td>
would not work so use
<td><? echo date(“d m y (D)”, strtotime($row['created'])) ?></td>
(paraphrased/untested) : – find . -type f -mtime xx -exec rm {}\;
doesn’t always have a high enough resolution when you want to remove a file
that is seconds or minutes old.
In my application, I have “guest writers” who preview their web content
before submitting for review. I don’t want web robots to index this content
(so will have a meta in the html to that effect anyway) and I don’t want
nosy readers of my sites to be familiar with tmp files which are under the
wwwroot so they can read stuff that has yet to be approved AND also I want to
do good housekeeping and remove tmp content fairly quickly.
I could use a “staging” web server, after they author presses the
preview button, a temp web page is rendered. I can delete this page within
seconds of it being viewed – this is fine.
The following code will be run in cron, maybe every half an hour
Where
time resolution is in seconds thus the division by 60 to get minutes
bash does not do natively division hence the pipe to bc
the file is the modify time
#!/bin/bash
# echo " (`date +%s` - `stat -c %Z 12345`) / 60" | bc -l
for i in `ls -b $FILEPATH`;
do
U=$(( (`date +%s` - `stat -c %Z $i`) / 60 | bc -l ))
if [ $U -gt 30 ]; then
echo "$i is too old - will delete $U"
# insert the DANGEROUS bit here
else
echo "too young - will not delete $U";
# no dangerous bit here
fi
done
If table not found errors occur on target db after transferring database then do the following:
1. check permissions on the folders and files under /var/lib/mysql (esp if you copied as root). Files should be mysql:mysql, as a rule. 2. On the source db, mysql> select table_name,table_type,engine from information_schema.tables where engine='InnoDB'; +--------------+------------+--------+ | table_name | table_type | engine | +--------------+------------+--------+ | crypto | BASE TABLE | InnoDB | +--------------+------------+--------+ x rows in set (5.80 sec) The convert the db to ISAM mysql> alter table crypto engine=MyISAM; Query OK, 0 rows affected (0.12 sec) Records: 0 Duplicates: 0 Warnings: 0