# Automated Scripts

## Recommended Posts

For those that i mentioned to previously about some of my automated scripts:

Auto Restart,

this is a scheduled task within windows that most of you know how to do (i hope) for windows 2003:

You need to run through the create a new scheduled task:

Start > Control Panel > Scheduled Tasks > Add Scheduled Task

1. Click Next

2. Browse to C:\Windows\system32\shutdown.exe

3. Click Next

4. Name it what you would like, i usually name it automatic restart

5. You want to run it monthly

6. Click Next

7. Start time would normally be between 1a.m. and 6a.m. but up to you i would have it offset for all of your servers so that not all of them are down at once.

8. I have it run the first sunday of the month, but you can choose when to do this.

9. Leave all of the months checked

10. Click Next

11. Enter your account information

12. Click Next

13. Check the box to open the advanced properties for the task.

14. Click Finish

15. When it opens in the "Run:" Field you want to make sure it looks like this;

C:\WINDOWS\system32\shutdown.exe -r -t 00


16. Click on apply

17. Enter your Information once again

And your done with that, pretty easy, unfortunately no nice way to create an exported file per server, so it has to be created manually per server, unless something with the exported <filename>.job file i dont know about yet.

Now automatic restarts of the Windows Server 2008:

Look at included Auto-Restart.xml and import it into your Task Scheduler.

In my tests it will have you change from my username and server name automatically when you import. If not you need to edit the Auto-Restart.xml and change the <UserID> field and the <Author> Field to your server name and your username following the format of the file.

Look at the included monitor_restart.bat file and make an scheduled task within windows to run this daily for you at a specified time of your choice.

MySQL Database Backups with FTP Upload:

There are 2 included files with this, tcadmin_mysql_backup.bat and tcadmin_ftp_mysql_backup.txt.

First off need to talk about tcadmin_mysql_backup.bat

@ECHO OFF
CLS
SET DD=%DATE:~7,2%
SET MM=%DATE:~4,2%
SET YYYY=%DATE:~10,4%
SET HH=%TIME:~0,2%
SET MN=%TIME:~3,2%
SET SS=%TIME:~6,2%

echo "Backing Up TCAdmin Database"

D:
cd mysqlbackups
del /f /q tcadmin-%YYYY%-%MM%-%DD%.sql


Open this file up and edit your mysqlusername your mysqlpassword the result file location and the database name.

this is mine(edited for security reasons):

@ECHO OFF
CLS
SET DD=%DATE:~7,2%
SET MM=%DATE:~4,2%
SET YYYY=%DATE:~10,4%
SET HH=%TIME:~0,2%
SET MN=%TIME:~3,2%
SET SS=%TIME:~6,2%

echo "Backing Up TCAdmin Database"

D:
cd mysqlbackups
del /f /q tcadmin-%YYYY%-%MM%-%DD%.sql


NOTE!!!! MAKE SURE YOU USE FORWARD SLASHES IN THE RESULT FILE FOR THE MYSQLDUMP PROGRAM!!! IF YOU DON'T IT WILL FAIL, \ IS CONSIDERED A LIMITING OR BREAKING CHARACTER!!!!

now for the tcadmin_ftp_mysql_backup.txt

open <server ip or hostname> <port>
binary
cd <path to backups>
lcd "<path to mysqladmin result file backup"
mput *.sql
yes
bye


Pretty self explainatory but i will include mine(edited for security reasons):

open 192.168.1.1 921
backups
binary
lcd "D:\mysqlbackups"
mput *.sql
yes
bye


As always with questions, comments, or requests, let me know.

EDIT: I also need to mention, nothing about my scripts require additional software to be download or installed, it uses windows built in programs or mysql's built in programs when you install it. MySQL backup has been tested on 5.0.67 and up and was confirmed working.

Thanks,

Jeremiah Shinkle

scripts.zip

##### Share on other sites

Nice share, I'm sure some will find it very useful and informative.

##### Share on other sites

Nice share, I'm sure some will find it very useful and informative.

Thanks Man, just trying to help, some people may not know the inter-workings with windows and what not, or are not comfortable having to stay logged into windows for MySQL Administrator to do the automated backup files for you, this does it via an automated scheduled tasks =]

#### Archived

This topic is now archived and is closed to further replies.

• ### Who's Online   0 Members, 0 Anonymous, 5 Guests(See full list)

• There are no registered users currently online
×
×
• Create New...

## Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use