Cron Jobs
Re: Cron Jobs
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
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.
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Cron Jobs
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*
*crosses fingers*
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Cron Jobs
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:Note: c:\[location of mysql] line must ALL be on ONE line, or the batch file will not work.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!
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: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.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.
Re: Cron Jobs
Thanks SpiritWebb. Having a schedule backup of the mysql database is definitely something I will want to have.
Re: Cron Jobs
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:Note: c:\[location of mysql] line must ALL be on ONE line, or the batch file will not work.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!
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: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.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.
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!
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Cron Jobs
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.
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: Cron Jobs
You can also access task scheduler through "all programs-> accessories->system tools"
and KunoNoOni, what where you ROTFL-ing at?
Pax.
and KunoNoOni, what where you ROTFL-ing at?
Pax.