Forum Moderators: coopster

Message Too Old, No Replies

Cron job creating backup files in root folder on server

cron jobs creating backup files

         

msarath

3:12 am on Jun 6, 2005 (gmt 0)

10+ Year Member



In root folder of my server, I see files like optimize.php.95(optimize.php is the file name we added for cron); files go from .1 and upward. Also happens for other files, seemingly related to the cron jobs we are running. When I open and download the files, there is no content in the files. Do you know what is causing these files to be created? I think they are harmless, except that I think it prevents us from seeing backups generated in root folder, as ftp only allows so many files to be listed. For example, I created a recent backup, but cant seem to find it in the root folder using ftp (I think because these files are crowding out the backups from being listed).

Are these files unnecessary? How do we eliminate these files to be created.

Thanks!

jatar_k

4:27 pm on Jun 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



with out having a better understanding pf the cron itself I have absolutely no idea.

off the top of my head I think something is wrong

msarath

4:36 pm on Jun 6, 2005 (gmt 0)

10+ Year Member



Files specified in CRON are executing successfully, the backup file like filename.php.1 so on are getting created. Suppose if the CRON job runs on daily basis, the backup file is incremented every day. But the file is 0kb wihout any content in it.

jatar_k

4:46 pm on Jun 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



and the content of the backup should be in that file?

msarath

5:02 pm on Jun 6, 2005 (gmt 0)

10+ Year Member



No content in the file, actually I don't want the back up file to be created.

jatar_k

5:14 pm on Jun 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would start by looking at the code in the cron then, seems that should be the issue.

msarath

5:26 pm on Jun 6, 2005 (gmt 0)

10+ Year Member



My cron file is Optimize.php which will optimize all the tables in my database every day. This file I have added in CRON jobs of my site CPanel.

The code written in optimixe.php is below....

$sql = "SHOW DATABASES";
$dbs_result = mysql_query($sql);
if(mysql_num_rows($dbs_result))
{
while($dbs_row=mysql_fetch_assoc($dbs_result))
{
$database = $dbs_row["Database"];
##echo "\n\nOptimizing database $database : \n";
mysql_select_db($database, $db);
$sql = "SHOW TABLE STATUS";
$tbls_result = mysql_query($sql);
if(mysql_num_rows($tbls_result))
{
while($tbls_row=mysql_fetch_assoc($tbls_result))
{
$TableName = "`".$tbls_row["Name"]."`";
$sql = "REPAIR TABLE ".$TableName;
##echo "\n".$sql;
mysql_query($sql);
$sql = "OPTIMIZE TABLE ".$TableName;
##echo "\n".$sql;
mysql_query($sql);
}
}
}
}
##echo "\n\n";
if ($db) mysql_close($db);

jatar_k

9:07 pm on Jun 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hmm, not sure, I wonder if the crons are just directing empty output to those files

maybe ask your host, we had a few doing that at one point and our admin fixed them