Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am fairly new to both linux and mysql… I have a cron job that runs every minute to move data from one mysql table to another (both tables are in the same database), see below:
Cron job is cronupdsysklog2:
mysql -u *** --password=*** syslog < /var/scripts/updsysklog2
INSERT INTO sysklog2 (machine,facility,priority,logdate,logtime,message)
SELECT machine, facility, priority, cast(left(date1,8) as date) as logdate, cast(right(date1,6) as time) as logtime, message FROM sysklog;
DELETE FROM sysklog;
The problem I am having is every time this runs it adds ~250k to memory and doesn’t release it then server locks up every 5 or 6 days.
Any ideas on how to fix this?
FYI... I made the script executable by using:
chmod 700 /var/scripts/cronupdsysklog2
One solution I could think of would be to use a PHP script instead. There are tutorials out there that explain about running them using cron.
That way you can use the PHP mysql_connect and mysql_close methods. I think this would help free up resources...oh and using mysql_free_result after you use the mysql_query method.
I changed it to a PHP cron job and I am still having the same problem, every minute the job runs ram usage increase by 200-500k. Here is the php script i wrote:
$connect = MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to the database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
$insert = "INSERT INTO sysklog2 (machine,facility,priority,logdate,logtime,message) SELECT machine, facility, priority, cast(left(date1,8) as date) as logdate, cast(right(date1,6) as time) as logtime, message FROM sysklog;";
$query = mysql_query($insert);
$delete = "DELETE from sysklog;";
$query = mysql_query($delete);