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 829 korisnika na forumu :: 57 registrovanih, 8 sakrivenih i 764 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, _Petar, _Sale, A.R.Chafee.Jr., Arhiv, axa, brufen2, BSD, cicus91, cropape, dolinalima, dragoljub11987, Drug pukovnik, Duško, ekser222, filiplukac1337, Gama, ikan, Insan2, ivance95, ivica976, kaptain2, kovinacc, Kubovac, KUZMAR, Libertas2, Marko Marković, Markoni29, Mercury, Metanoja, micoboj, Milos ZA, mrmr, nradukic, pedjolino76, pein, RecA2, robertino, SD, sevenino, Shomy, Skywhaler, sosko2, spektorsky, srbi, StefanNBG90, TheChains, Toni, TwisterMJ, vathra, vladetije, vobo, Voivoda, voja64, yrraf, ZoranB., šumar bk2