Page 3 of 4

Re: Cron Jobs

Posted: Sun Jun 27, 2010 6:15 pm
by Zyviel
If you would create a tutorial on PHP security that would be awesome. I'm sure it would save myself and probably many others alot of time researching how to do basic security properly.

Re: Cron Jobs

Posted: Sun Jun 27, 2010 10:19 pm
by Rastan
Yeah def just a rundown of some things would help. I have been researching it with everything else but I'm still pretty hazy on it. A tutorial on the basic major things that would ruin a game would be awesome.

Re: Cron Jobs

Posted: Mon Jun 28, 2010 9:12 pm
by SpiritWebb
I used the link I provided and have setup the job to run at 4:30pm, in about 20 minutes. I will post again if it successfully works...and I will include the batch file in which I used to do it.

*crosses fingers*

Re: Cron Jobs

Posted: Mon Jun 28, 2010 10:37 pm
by SpiritWebb
I ran the job and it completed successfully. So, if you are running WAMP, here is how you would write a cron in windows.
Create a document and save it as mysql-backup.bat (I opened notepad and done it, but your choice on how.) It is important that it is not saved as a .txt file.

Then in the batch file put the following:

Code: Select all

@echo off
echo Running backup...
c:\[location of mysql]\bin\mysqldump -u [username] -p [password]  --result-file="c:\backup.%DATE:~0,3%.sql" [database name] //remove the brackets and this comment
echo Done!
Note: c:\[location of mysql] line must ALL be on ONE line, or the batch file will not work.
c:\wamp\bin\mysql\mysql5.1.36\bin\mysqldump -u admin -p ******** --result-file="c:\backup.%DATE:~0,3%.sql" *****

The above location is where my database goes too. If its the same location, then just simply copy it. I have *** out certain information, but if you are not using a password, and simply using root as your username, then it would be -u root --result-file=".

Then after you put all that into your batch file, save it somewhere, and open up the command prompt. And type the following:

Code: Select all

at 02:00 /every:M,T,W,Th,F,S,Su c:\<path>\mysql-backup.bat where <path> is the location of where you put the mysql-backup.bat file.
What this is doing is backing up the chosen database at 2am daily to your chosen location in the mysql-backup.bat file. That should be all you need to do. If you need to remove the backup, simply do at [id] /delete and it will remove it. Simply do at to see what ID your job is.

Re: Cron Jobs

Posted: Tue Jun 29, 2010 12:54 am
by Zyviel
Thanks SpiritWebb. Having a schedule backup of the mysql database is definitely something I will want to have.

Re: Cron Jobs

Posted: Tue Jun 29, 2010 9:59 am
by Falken
SpiritWebb wrote:I ran the job and it completed successfully. So, if you are running WAMP, here is how you would write a cron in windows.
Create a document and save it as mysql-backup.bat (I opened notepad and done it, but your choice on how.) It is important that it is not saved as a .txt file.

Then in the batch file put the following:

Code: Select all

@echo off
echo Running backup...
c:\[location of mysql]\bin\mysqldump -u [username] -p [password]  --result-file="c:\backup.%DATE:~0,3%.sql" [database name] //remove the brackets and this comment
echo Done!
Note: c:\[location of mysql] line must ALL be on ONE line, or the batch file will not work.
c:\wamp\bin\mysql\mysql5.1.36\bin\mysqldump -u admin -p ******** --result-file="c:\backup.%DATE:~0,3%.sql" *****

The above location is where my database goes too. If its the same location, then just simply copy it. I have *** out certain information, but if you are not using a password, and simply using root as your username, then it would be -u root --result-file=".

Then after you put all that into your batch file, save it somewhere, and open up the command prompt. And type the following:

Code: Select all

at 02:00 /every:M,T,W,Th,F,S,Su c:\<path>\mysql-backup.bat where <path> is the location of where you put the mysql-backup.bat file.
What this is doing is backing up the chosen database at 2am daily to your chosen location in the mysql-backup.bat file. That should be all you need to do. If you need to remove the backup, simply do at [id] /delete and it will remove it. Simply do at to see what ID your job is.

If you want you can also use the GUI to create tasks, just press Win-R (to open run window) and type Taskschd.msc and press ok and you get a nice GUI where you can create and manage tasks easily.

Re: Cron Jobs

Posted: Tue Jun 29, 2010 5:46 pm
by SpiritWebb
I tried that command, and it didn't work for me. I will try again on the work computer to which I am using to build the internal website.

Re: Cron Jobs

Posted: Tue Jun 29, 2010 6:47 pm
by KunoNoOni
ROFL!



-KunoNoOni

Re: Cron Jobs

Posted: Tue Jun 29, 2010 8:57 pm
by SpiritWebb
KunoNoOni wrote:ROFL!



-KunoNoOni
?

Re: Cron Jobs

Posted: Wed Jun 30, 2010 2:00 am
by PaxBritannia
You can also access task scheduler through "all programs-> accessories->system tools"

and KunoNoOni, what where you ROTFL-ing at?

Pax.