Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

urban sheep http://www.livejournal.com/users/urbansheep/

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

Setting up a php-script to run as a cron-job

To run a php-script as a regular job, you need just point to the php-cli instance with the path to your script:

/usr/local/bin/php /home/username/public_html/scripts/your_script.php


Thanks to Jason for original tip @ http://forum.textdrive.com/viewtopic.php?id=863

Creating a quick dump for your mysql database

Doing dumps is a common task but I always forget exact code to do that, and looking for exact page manual is dull. Here goes the generic code:

Mysql Pre-4.1
mysqldump -u username -p password --quick [database [table1, table2, ...]] > backup_db.sql


4.1 and up
mysqldump -u username -p password [database [table1, table2, ...]] > backup_db.sql


Great for doing maintenance backups via cron, or just occasional dumps for off-site storage and archival.

And useful shorthand for the manual:
http://dev.mysql.com/doc/mysql/en/mysqldump.html
« Newer Snippets
Older Snippets »
2 total  XML / RSS feed