hi just been playing around with the code listed
got around to this
Code:
TABLE_NAME=userips
USER_NAME=user
IP_ADDR=localhost
PASSWORD=password
somevar=`echo "TRUNCATE TABLE userips" | mysql -h $IP_ADDR -u $USER_NAME -p $PASSWORD $TABLE_NAME `
echo $somevar
just a few questions though
do i not need to add in my database name somewhere in there as i have around 20 databases on this server
also the somevar= part , is that looking correct or should that be placed after the mysql command
also finally what type of file do i save this as , should it be a .sh file, then do you no the correct syntax i should enter in cron to enable this to run every day
i used something like this to backup my database every day
Quote:
|
0 0 * * * /usr/bin/mysqldump -u user database -p pass > /var/www/vhosts/mysite.com/httpdocs/sql-backup/dbbackup.sql
|
but i'm not to sure how to modify this in order to change it to truncate or delete info from just one table
the userips table fills up very quickly with lots of ips(10,000 per day), thats why i need to delete hem every day
its a pain having to login to phpmyadmin every day to just click the truncate table button on the usrips table