Cron Jobs

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Zyviel
Posts: 75
Joined: Tue Jun 08, 2010 8:12 pm

Re: Cron Jobs

Post 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.
Rastan
Posts: 126
Joined: Tue Apr 13, 2010 1:48 am

Re: Cron Jobs

Post 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.
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Cron Jobs

Post 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*
Image

Image
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Cron Jobs

Post 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.
Image

Image
Zyviel
Posts: 75
Joined: Tue Jun 08, 2010 8:12 pm

Re: Cron Jobs

Post by Zyviel »

Thanks SpiritWebb. Having a schedule backup of the mysql database is definitely something I will want to have.
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: Cron Jobs

Post 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.
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Cron Jobs

Post 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.
Image

Image
User avatar
KunoNoOni
Posts: 61
Joined: Sun May 09, 2010 1:54 am

Re: Cron Jobs

Post by KunoNoOni »

ROFL!



-KunoNoOni
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Cron Jobs

Post by SpiritWebb »

KunoNoOni wrote:ROFL!



-KunoNoOni
?
Image

Image
User avatar
PaxBritannia
Posts: 680
Joined: Sun Apr 18, 2010 1:54 pm

Re: Cron Jobs

Post by PaxBritannia »

You can also access task scheduler through "all programs-> accessories->system tools"

and KunoNoOni, what where you ROTFL-ing at?

Pax.
Post Reply

Return to “Advanced Help and Support”