Schedule a Bash Shell Script in Windows

Yes, Cygwin make shell script happen in Windows. I need to do Rsync on some “folder” to some “Directory”, just make the bash file with rsync in side (/cygwin/home/Administrator/rsync_script.sh) then go to Schedule Task

New Task -> Name your task

Action -> New -> Start a Program
Path: C:\Cygwin\bin\bash.exe
Argument: -l -c “/home/Administrator/rsync_script.sh >> /home/Administrator/daily.log  2>&1”

Google Drive as a Service in Windows Server

Google Drive as a Service in Windows Server

I need to backup stuff to another Google Drive folder, it work when I finish install Google Drive, after I log out of the server, it stop working, because Google Drive was designed as a Personal app. To make it work as a service I need to run Google Drive by Task Scheduler with appropriate Permission, which mean the user install the app also a user running the task.

After install Google Drive -> Turn off start Google Drive at boot option

Then Go to Task Scheduler and follow the IMGs belows:

Screenshot from 2016-03-03 10:25:47

Screenshot from 2016-03-03 10:26:00

Screenshot from 2016-03-03 10:26:10

Screenshot from 2016-03-03 10:26:28

 

Schedule a Batch script in Windows

Schedule a Batch script in Windows

Here is the batch script, which remove everything in myfolder.

set folder="C:myfolder"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)

I put it on C:/rmStuffInMyfolder.bat

Schedule a Batch File to run automatically

Step 1: Create a batch file you wish to run and place it under a folder where you have enough permissions. For example under C drive.

Step 2: Click on Start and under search, type in Task and click open Task Scheduler.

Step 3: Select Create Basic Task from the Action pane on the right of the window.

Step 4: Under Create Basic Task, type in the name you like and click Next.

Step 5: From the Trigger select the option you like and click Next.

I chose Daily and clicked Next, which brought me to this screen.

Step 6: Then click on Start a Program and click Next.

Step 7: Now click on Browser and select the batch file you like to run.

Step 8: Finally, click on Finish to create the Task.

Now that we have created a Task, we have to make sure it runs with the highest privilege. Since we have UAC settings we have to make sure that when you run the file it should not fail if it does not bypass the UAC settings.

So click on Task Scheduler Library.

Then double click on the Task you just created.
Step 8: Click on Run with Highest privilege then click OK.

Congratulations!

How to schedule a Batch File to run automatically in Windows 10/8/7

Varnish 4 – Failover Director

vcl 4.0;
import directors;
backend static_server {
    .host = "aa.bb.cc.dd";
    .port = "80";
    .probe = { .url = "/"; .timeout = 200 ms; .interval = 1s; .window = 6; .threshold = 5; }
}
backend static_server_2 {
    .host = "aa.bb.cc.ee";
    .port = "80";
    .probe = { .url = "/"; .timeout = 200 ms; .interval = 1s; .window = 6; .threshold = 5; }
}


sub vcl_init {
    new cluster = directors.fallback();
    cluster.add_backend(static_server);
    cluster.add_backend(static_server_2);

}

sub vcl_recv {
    set req.backend_hint = cluster.backend();

    #unset req.http.Cookie;
    #unset req.http.Cache-Control;

}

Ref: http://smemoratesysop.blogspot.com/2015/05/failover-director-for-varnish-40.html