# VPS & Dedicated Servers

cancel
Showing results for
Show  only  | Search instead for
Did you mean:
Go to solution
New

## How to run a script on Windows-based GoDaddy

I need '101 help' to run a script for my new domain totallywolfgang.com. I found the task scheduler and I did something very basic to test. I created directory "/ftp/test" and an empty file 'Test.txt' in it, and I created a script 'test.php' in "/cgi-bin" like so:

&lt?php
rename("G:\PleskVhosts\totallywolfgang.com\ftp\test\Test.txt", "G:\PleskVhosts\totallywolfgang.com\ftp\test\Test.tmp");
?&gt

(Note: I put &lt and &gt here to post, they are the actual less than and greater than characters.)

I scheduled it with command line/argument as per the help:

G:\PleskVhosts\totallywolfgang.com\cgi-bin\test.php

I expected the file there to be renamed after I pressed "Run now" in the scheduler, but nothing happened. I don't know where to look for output or how to write to a log. Any script or executable will do, I am not deadset on php. However, I want to list files and if present rename/move them on the server say every 5 minutes. This is just a hardcoded baby step.

Any advice on whether and how I can do it (and ideally debugging/logging help) is appreciated.

If you know a link on this topic that explains the steps, that would work.

Thanks,
Wolfgang

1 ACCEPTED SOLUTION
New

Dear CG:

Thanks. With the help of GoDaddy Chat I found out what was wrong. I'm posting it here to possibly help others.

The only area you can access is 'httpdocs', so the scheduler could not find my script or my file. The executable line in the scheduler is:

The argument line in my case is:

G:\PleskVhosts\totallywolfgang.com\httpdocs\MyScripts\test\script_test.php

I created subdirectories under httpdocs.

For initial testing, it's best to check everything (every minute, every hour, ...) and enable/disable the task for testing as needed.

I did this (not sure it's best but it works well for me) and I leave out tag brackets for posting here:

?php

$MyRoot = 'G:\PleskVhosts\totallywolfgang.com\httpdocs';$MyDir1 = $MyRoot . “\\sub1\\sub2”;$MyLog1 = $MyRoot . “\\sub1\\sub2\\log.txt”; ? Oh, and I found this for logging: file_put_contents($LogFile, $LogLine, FILE_APPEND | LOCK_EX); It appends a line to a file. Hope this helps someone... 3 REPLIES 3 Moderator Hey @wolftxusa First let me say welcome to the community! Unfortunately, I'm not an expert when it comes to using Task Schedulers within our Plesk shared hosting plans. However, it does sound like there are few other variables that you may be overlooking in getting the script to run. My suggestion in this instance is to reach out to our live support so our hosting team can help review this further. They'll be better able to review all the variables with you directly or even suggest an alternative to complete the task if the 'rename' function can't be used in this instance. Let us know how it goes. CG - GoDaddy | Community Moderator 24/7 support available at x.co/247support New Dear CG: Thanks. With the help of GoDaddy Chat I found out what was wrong. I'm posting it here to possibly help others. The only area you can access is 'httpdocs', so the scheduler could not find my script or my file. The executable line in the scheduler is: C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP54\php-cgi.exe The argument line in my case is: G:\PleskVhosts\totallywolfgang.com\httpdocs\MyScripts\test\script_test.php I created subdirectories under httpdocs. For initial testing, it's best to check everything (every minute, every hour, ...) and enable/disable the task for testing as needed. I did this (not sure it's best but it works well for me) and I leave out tag brackets for posting here: ?php$MyRoot = 'G:\PleskVhosts\totallywolfgang.com\httpdocs';

$MyDir1 =$MyRoot . “\\sub1\\sub2”;

$MyLog1 =$MyRoot . “\\sub1\\sub2\\log.txt”;

?

Oh, and I found this for logging:

file_put_contents($LogFile,$LogLine, FILE_APPEND | LOCK_EX);

It appends a line to a file.

Hope this helps someone...

Moderator

Hey @wolftxusa,

Awesome follow-up!

I'm sure other members will find this helpful! Thanks for taking the time to share it!

CG - GoDaddy | Community Moderator