Jump to content



Photo
* * * * * 3 votes

SiteMonitor


  • Please log in to reply
2155 replies to this topic

#41   matrix2223

matrix2223
  • Members
  • 862 posts
  • Real Name:Eric
  • Gender:Male
  • Location:MD USA

Posted 15 August 2006 - 00:37

Hi Jack,

Im not getting any errors from the cron job. When it sends me the email it says everything is fine. Even though I have been working on it and adding a bunch of new files. Howerver when I run it automatically. It tells me all the necessarry stuff. No biggie to me I was just wondering if it was something that I was supposed to set with it the sitemonitor.php

Thanks,

Eric
Eric

Keep up on osCommerce changes and updates at Github | Understand osCommerce a little further at OsCommerce Documentation | Copy and paste your error message in Google add "in osCommerce" at the end to get relevant answers to most issues.


#42 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 15 August 2006 - 02:24

The only difference between running it from cron and manually, is that the path may be different. Try deleting the reference file and let cron create it when it runs. That might fix it.

Jack

#43   pyramids

pyramids
  • Members
  • 380 posts
  • Real Name:Jeff
  • Gender:Male
  • Location:Pennsylvania

Posted 24 August 2006 - 03:48

Jack
I modified the script to do the following:

1: Keep a detailed log
2: Update the reference file every time there are changes.
3: Added a timer
4: Will now check all file changes including deleted files
5: List sub directories to exclude
6: Removed the call to "require('includes/application_top.php')" and updated the mail function
7: Updated message and email reporting

Besides being a script to keep an eye out for hackers....especially any 777 folders - it now is a
great way to journal any modifications automatically.

If you are interested I will post the script

#44 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 24 August 2006 - 03:55

Update the reference file every time there are changes.

Doesn't this defeat the purpose? If an email is missed or not delivered for some reason, one would never know a change has been made.

Jack

#45   pyramids

pyramids
  • Members
  • 380 posts
  • Real Name:Jeff
  • Gender:Male
  • Location:Pennsylvania

Posted 24 August 2006 - 04:07

I updated the script to be more of a journal to keep a running list of all changes. This way a year from now I won't be referencing files I may have removed or changed due to a modification. The script updates a log besides the email so a missing email shouldn't be a problem.

#46   pyramids

pyramids
  • Members
  • 380 posts
  • Real Name:Jeff
  • Gender:Male
  • Location:Pennsylvania

Posted 24 August 2006 - 19:20

I updated the script to be more of a journal to keep a running list of all changes. This way a year from now I won't be referencing files I may have removed or changed due to a modification. The script updates a log besides the email so a missing email shouldn't be a problem.


Jack,
After thinking about it you have a good point...In regard to the ref file and when it is written:

I added the ability for the user to choose between a journal that writes a new ref file every time there are changes or the original way of writing the file one time only that can only be overwritten when the user deletes the ref file.

Have a nice day!

#47   Sid04

Sid04
  • Members
  • 433 posts
  • Real Name:Bob bob

Posted 27 August 2006 - 14:35

5: List sub directories to exclude
6: Removed the call to "require('includes/application_top.php')" and updated the mail function


Im interested in those two changes. Can we just remove the 'require('includes/application_top.php')' part without anything else being effected? Some of my cron job errors refer to application_top.php.

Edited by Sid04, 27 August 2006 - 14:38.


#48   pyramids

pyramids
  • Members
  • 380 posts
  • Real Name:Jeff
  • Gender:Male
  • Location:Pennsylvania

Posted 27 August 2006 - 15:06

Im interested in those two changes. Can we just remove the 'require('includes/application_top.php')' part without anything else being effected? Some of my cron job errors refer to application_top.php.


It is more involved than just a few simple changes.

PM me with your email address and I will email you the updated script.

#49 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 27 August 2006 - 19:02

Im interested in those two changes. Can we just remove the 'require('includes/application_top.php')' part without anything else being effected? Some of my cron job errors refer to application_top.php.

If your cron job is failing on that, it is because it is not setup correctly. You probably have to add a command to cd into the admin directory, something like
cd /home/user/public_html/admin/;

Jack

#50   Charles_K

Charles_K
  • Validating
  • 9 posts
  • Real Name:Charles Kj√∂bek
  • Gender:Male
  • Location:Sweden

Posted 12 September 2006 - 10:46

Hi,

Is it possible to get this great contribution to check changes in directory permissions also?
/Charles K
Get Tattoo'd and feel the power of the needle's...

#51 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 12 September 2006 - 13:21

The original code did check the directories but I changed it for speed. My thinking was that there isn't any reason to check directories since, if someone hacked into your site, it would be a waste of time for them to just change the directory settings. Is there another reason you would want those monitored?

Jack

#52   englishshire

englishshire
  • Members
  • 1 posts
  • Real Name:Chris Forsey

Posted 22 September 2006 - 16:32

In case any body is interested: try the following to get the manual way to run in admin area.


1 In sitemonitor.php find line 29 ish and make sure:

define('VERBOSE', 1);

2 Edit admin/includes/boxes/tools.php

Add the following line to the end of ' $contents[] = array( ' after last '<a href'

'<a href="' . tep_href_link(sitemonitor.php) . '" class="menuBoxContentLink">' . BOX_TOOLS_SITEMONITOR . '</a>');

Remember to replace '</a>'); on previous line with '</a><br>' . or you will get an error

3 Edit admin/includes/languages/english.php

Add the following:

define('BOX_TOOLS_SITEMONITOR', 'Site Monitor');



Under tools section in admin should be site monitor. This will manually run the check and display the results.

Once finished click back button.

Chris

#53   my3sons

my3sons
  • Members
  • 24 posts
  • Real Name:Scotty

Posted 02 October 2006 - 13:16

chmod your admin directory with 777 but DON'T chmod the files within! just the directory!



Is this safe? Without doing this I get an openbase dir error, but I'm a bit concerned about 777ing the admin directory.

Thanks... very nice and simple contrib.

#54 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 02 October 2006 - 14:11

I wouldn't recommend it but your host might require such a setting.

Jack

#55   hankster6911

hankster6911
  • Members
  • 43 posts
  • Real Name:Wendy

Posted 16 October 2006 - 11:53

I can manually run site monitor with great results, I am new to cron jobs but I tried to set it up and this was the result I got.

Status: 404
X-Powered-By: PHP/4.4.2
Content-type: text/html

No input file specified.

This is the command I used
php /home/xxxx/public_html/catalog/xxxx/sitemonitor.php

Since I am unfamiliar with cronjobs I am not sure this error No input file specified is on my side in the cron job or I need to set something in the php files.

Thank you
Wendy

#56 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 16 October 2006 - 13:26

The syntax for cron jobs vary with hosts. You may have to cd into your admin directory for it to work. Your host should be able to provide you with the proper syntax but you could try
cd /home/xxxx/public_html/catalog/xxxx/; php sitemonitor.php

Jack

#57   digbydo

digbydo
  • Members
  • 564 posts
  • Real Name:Dave
  • Location:Lancashire, UK

Posted 28 October 2006 - 08:11

I can manually run site monitor with great results, I am new to cron jobs but I tried to set it up and this was the result I got.

Status: 404
X-Powered-By: PHP/4.4.2
Content-type: text/html

No input file specified.

This is the command I used
php /home/xxxx/public_html/catalog/xxxx/sitemonitor.php

Since I am unfamiliar with cronjobs I am not sure this error No input file specified is on my side in the cron job or I need to set something in the php files.

Thank you
Wendy

I received a similar error 404 when setting up cron... removed the bit that Jack mentions in the path as USERNAME and it worked perfectly. :thumbsup:

Cheers Jack, great contribution!

----------
Dave
one-click installation..
Dave's info

#58   RCWS

RCWS
  • Members
  • 48 posts
  • Real Name:Toby Wilson
  • Location:Jacksonville, Florida

Posted 30 October 2006 - 14:32

This is the results Im getting when I run SiteMonitor manualy.........

What am I doing wrong ?


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/18/d174507728/htdocs/rivercityweb/admin/sitemonitor.php:1) in /homepages/18/d174507728/htdocs/rivercityweb/admin/includes/functions/sessions.php on line 67
No new files found...
No deleted files found...
No size differences found...
No time mismatches found...
No permissions mismatches found...
Email sent to shop owner.
Toby Wilson

#59 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 30 October 2006 - 16:10

That is usually caused by a spaced in the file. See this.

Jack

#60 ONLINE   Jack_mcs

Jack_mcs
  • Members
  • 26,518 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 30 October 2006 - 19:31

A new version has been uploded. Here are the major changes:

- Added error_log to the excluded files code (works now).
- Added admin control section.
- Added code to allow sub-directories to be excluded.
- Added log function (creates a log of all changes if option is set).
- Fixed bug in functions file.

I didn't provide any update instructions since all of the files were changed. Just follow the install instructions in the readme. You can delete the sitemonitor_functions.php file from the admin directory since that has been moved to the functions directory.

Jack