This commans will dump the tables with prefix PREFIX:
mysql DATABASE -u USERNAME -p -e 'show tables like "PREFIX%"' | grep -v Tables_in | xargs mysqldump DATABASE -u USERNAME -p > DUMP.sql
Tuesday, July 2, 2013
Monday, June 17, 2013
Install ia32-libs in Debian Wheezy
Since Wheezy introduces multiarch, the
ia32-libs package in now deprecated. It is now possible to install 32bit packages directly:
dpkg --add-architecture i386 # enable multi-arch
apt-get update
apt-get install libc6:i386 # install base 32bit libraries
Monday, May 13, 2013
Delete files older X days or minutes
This command deletes all files /PATH/TO/FOLDER/YOUR_FILENAME_PATTERN
those older than 45 days:
find /PATH/TO/FOLDER/ -name YOUR_FILENAME_PATTERN -type f -mtime +45 -delete
and this for deleting files older than 30 minutes:
find /PATH/TO/FOLDER/ -name YOUR_FILENAME_PATTERN -type f -mmin +30 -delete
those older than 45 days:
find /PATH/TO/FOLDER/ -name YOUR_FILENAME_PATTERN -type f -mtime +45 -delete
and this for deleting files older than 30 minutes:
find /PATH/TO/FOLDER/ -name YOUR_FILENAME_PATTERN -type f -mmin +30 -delete
Tuesday, April 30, 2013
How to free Port 80 that already used in Windows 8
Solution 1:
Solution 2:
- Launch RegEdit
- Find HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
- Change the value of "start" to 4 (disabled)
- Reboot your computer
Solution 2:
- Go to Device Manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (and disable or manual some services depended on it).
- Reboot and use
Tuesday, April 16, 2013
Nagios PNP Warning after upgrade php to 5.3
I got these error and warnings from Nagios after I upgrade my PHP:
Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1032
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europa/Berlin' for 'Debian/Squeeze' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 557
Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php
To solve this problem you must edit this file: usr/local/nagios/share/pnp/include/function.inc.php
line 556: date_default_timezone_set('UTC');
line 1033: $pdf = new PDF('P', 'mm', 'A4');
line 1543: if($level == 2 && $type == "complete" && preg_match("/^NAGIOS_/",$tag)){
Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1032
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europa/Berlin' for 'Debian/Squeeze' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 557
Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php
To solve this problem you must edit this file: usr/local/nagios/share/pnp/include/function.inc.php
line 556: date_default_timezone_set('UTC');
line 1033: $pdf = new PDF('P', 'mm', 'A4');
line 1543: if($level == 2 && $type == "complete" && preg_match("/^NAGIOS_/",$tag)){
Friday, February 1, 2013
MySQL comparing timestamp with date
To find records older than 30 days using timestamp field:
Select from TableName where from_unixtime(tstamp) < (NOW() - INTERVAL 30 day);
Thursday, January 31, 2013
Extracting the string between two patterns in a file
Supose the file contains this phrase: That is just a test for you
I need to extract the patterns between the words is and test:
sed -e 's/.*is//' -e 's/test.*$//' /Path-To-Your-File/yourfile.txt
and the result is:
just a
I need to extract the patterns between the words is and test:
sed -e 's/.*is//' -e 's/test.*$//' /Path-To-Your-File/yourfile.txt
and the result is:
just a
Tuesday, January 22, 2013
Find out MySQL Time & Zone
for global and session time zone run this query:
mysql> SELECT @@global.time_zone, @@session.time_zone;
for get current time from MySQL Server run this query:
mysql> select now() ;
mysql> SELECT @@global.time_zone, @@session.time_zone;
for get current time from MySQL Server run this query:
mysql> select now() ;
Monday, December 17, 2012
Find Files By Date
If you need a specific date range, than consider using
the find command.
In this example find files modified between 15 December 2012 and 16 December 2012, in /var directory:
In this example find files modified between 15 December 2012 and 16 December 2012, in /var directory:
touch --date "2012-12-15" /tmp/start
touch --date "2012-12-16" /tmp/end
find /var -type f -newer /tmp/start -not -newer /tmp/end
Thursday, December 13, 2012
Forcing qmail to process the queue
Run this command:
kill -ALRM `ps ax | grep qmail-send | grep -v grep | awk '{print $1}'`
kill -ALRM `ps ax | grep qmail-send | grep -v grep | awk '{print $1}'`
Adjusting qmail queue time / lifetime
if you want to adjust how long e-mails will spend in the qmail queue before they're bounced, simple set the queuelifetime:
The above example is for 1 day (qmail needs the time length in seconds). Just take the days and multiply by 86,400 seconds to get your result.
# echo "86400" > /var/qmail/control/queuelifetime
# /etc/init.d/qmail restartThe above example is for 1 day (qmail needs the time length in seconds). Just take the days and multiply by 86,400 seconds to get your result.
Monday, November 19, 2012
Delete Documents From Solr Index By Query
If you simply want to delete documents from your Solr index by using the web interface, here's a code snippet that lets you do so:
This lets you delete documents where the id field matches XXXXX.
If you want to delete items that matches more than one field, just add another query:
If you want to delete all items in the index, just use this query:
http://localhost:8080/solr/update?stream.body=<delete><query>id:XXXXX</query></delete>&commit=true
This lets you delete documents where the id field matches XXXXX.
If you want to delete items that matches more than one field, just add another query:
http://localhost:8983/solr/update?stream.body=<delete><query>id:XXXXX</query><query>entitytype:YourContent</query></delete>&commit=true
If you want to delete all items in the index, just use this query:
<delete><query>*:*</query></delete>
Source: http://blog.dileno.com/archive/201106/delete-documents-from-solr-index-by-query/
Tuesday, November 13, 2012
Old Version MediaWiki & PHP 5.3
when you use old version of MediaWiki and PHP 5.3, you should see this error:
You must change only the Namspace calss with MWNamespace:
go to your MediaWiki root directory (please make a backup first) and run this command:
PHP Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING You must change only the Namspace calss with MWNamespace:
go to your MediaWiki root directory (please make a backup first) and run this command:
find -name "*.php" -exec sed -i 's/Namespace::/MWNamespace::/g' {} \;
Subscribe to:
Posts (Atom)