Automatsko izvršavanje skripta

Automatsko izvršavanje skripta

offline
  • Senor  Male
  • Ugledni građanin
  • Uroš Stegić
  • Pridružio: 19 Jul 2006
  • Poruke: 308
  • Gde živiš: Pančevo

Napisao sam skript koji adminu šalje e-mail sa nekakvim izveštajem koji izvlači iz baze. Kako da nateram apač da sam izvršava taj skript jednom nedeljno. Trenutno to funkcioniše tako što se u admin panelu nalazi dugme "pošalji izveštaj" i ovaj to jednom nedeljno klikne. Ali i admin je čovek, desi se da ne može ili zaboravi ili šta god pa bih ja automatizovao proces.



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Software developer
  • Pridružio: 06 Sep 2005
  • Poruke: 3800
  • Gde živiš: Beograd

Procitaj za cron job
http://forums.phpfreaks.com/topic/183152-running-a-cron-job-through-phpapache/
ili negde drugde izguglaj



offline
  • C# and PHP Developer
  • Pridružio: 16 Feb 2011
  • Poruke: 1622
  • Gde živiš: Pancevo

Koristi CRON kao sto je kolega nikola rekao!!! Evo ti jedan primer koji se koristi za automacki Back Up !

CRON :

#!/bin/sh #Set information specific to your site webroot="YOUR WEBROOT" db_host="YOUR DB HOST" db_user="YOUR DB USERNAME" db_password="YOUR DB PASSWORD" db_name="YOUR DB NAME" #Set the date and name for the backup files date=`date '+%F-%H-%M'` backupname="backup.$date.tar.gz" #Dump the mysql database mysqldump -h $db_host -u $db_user --password="$db_password" $db_name > $webroot/db_backup.sql #Backup Site tar -czpvf $webroot/sitebackup.tar.gz $webroot/web/content/ #Compress DB and Site backup into one file tar --exclude 'sitebackup' --remove-files -czpvf $webroot/$backupname $webroot/sitebackup.tar.gz $webroot/db_backup.sql #Upload your files to cloud files. #First argument is the location of the backup file, second argument is the name to be used when uploaded php $webroot/cloudfiles_backup.php $webroot/$backupname $backupname #After your backup has been uploaded, remove the tar ball from the filesystem. rm $webroot/$backupname

PHP

<?php // include the API - note we must use the absolute server path because this script will be executed through php technology and not http require("/YOUR WEBROOT/cloudfiles/cloudfiles.php"); // cloud info $username = "YOUR USERNAME"; // username $key = "YOUR API KEY"; // api key $containername = "YOUR CONTAINER NAME";  // container name // backup file name from command-line argument $backup = $argv[1]; // Name to use for file once uploaded $uploadname = $argv[2]; // Connect to Rackspace $auth = new CF_Authentication($username, $key); $auth->authenticate(); $conn = new CF_Connection($auth); // Get the container we want to use $container = $conn->get_container($containername); // upload file to Rackspace $object = $container->create_object($uploadname); $object->load_from_filename($backup); ?>

offline
  • arnage 
  • Novi MyCity građanin
  • Pridružio: 13 Feb 2013
  • Poruke: 16

Moze i: dev.mysql.com/doc/refman/5.1/en/events.html

Ko je trenutno na forumu
 

Ukupno su 983 korisnika na forumu :: 47 registrovanih, 6 sakrivenih i 930 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3028 - dana 22 Nov 2019 07:47

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: 5.56, A.R.Chafee.Jr., awathorn, Bane san, bankulen, caesar, cikadeda, darkangel, darkstar101, Deneb2, DJORDJE-NO-1, dolinalima, Duh sa sekirom, ekser222, goranmd, goxin, hyla, kljift, ljuba sd, ljubo70, lojola, machak, madza, mandicdamir245, Marko Marković, MB120mm, mgaji21, moldway, MrNo, Nebo_M, nuke92, oldtimer, powSrb, Profica, royst33, shaja1, Sr.Stat., stegonosa, USSVoyager, Vienna, VJ, vlvl, voja64, yrraf, zajcev1, zola92, Živković