Forum Moderators: phranque

Message Too Old, No Replies

Cron Questions ...

... best practice & how to zip / email a file

         

le_gber

6:15 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi All,

some quick questions to all server admin around here:

background info:
I am currently using cron to update my customers stats every morning. I want to offer them a more powerful web analytic solution which I would be running on my local machine and I therefore need to have the log files of the interested customers sent to me in the morning - either every day or once a week.

now my questions:

1. What is considered as best practice for a cron file
at the moment I have the command to update the stats as single lines of code (for each site) in my cron file - after a while it starts to become quite a huge file.

  • Should I use a .sh file to put all these command in and only call the .sh file from cron - to be honest my knowledge of server admin is very VERY limited (I'm only a web designer for g*d's sake ;))
  • Can I run all the update command at the same time - at the moment I have allowed 2 minuted between running each command because I was afraid that one log file update might come before another one ended.

    2. Regarding the zipping and emailing of the file

  • how do I do it?
  • will zipping a file automatically create a copy?
  • will emailing the .zip file automatically remove it from the server?
  • again should I run a .sh for the update of stats and another one for the zipping and emailing

    3. Just out of interest how many cron tasks can you run at the same time?

    Thanks for your help guys.

    Leo

  • vrtlw

    10:17 pm on Feb 26, 2005 (gmt 0)

    10+ Year Member



    I accomplished exactly this, albeit for a different application - db backups. It really is quite simple to do it in Perl. I used a timestamp in the filename and was able to rotate x days of backups locally, sent via ftp and also Emailed to me. With a little CGI I also put together a nice looking front end. 1 CRON job two scripts, one Perl and one CGI and an effective product to sell.

    le_gber

    11:47 am on Feb 28, 2005 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    thanks vrtlw,

    any idea how I can do it :)?

    Leo