How to group cron to plesk 11.0.9 - cron

I'm using Plesk 11.0.9 and I try to create a couple of crons for each website but don`t know how to group them by a specified domain or something.. to have a better view of them.
I`m on Website & Domain > Scheduled Tasks and i see a "System user" then when i click it .. i could create all cron jobs.
Thanks

I think the best grouping you could do is to include domain name in a script name. Technically any script can access all/any domains under one system account - only you would know a particular script's function.

Related

Azure website node process lifecycle

I 've found out that Azure websites (trial version) doesn't autostart my node sever process (it starts only when I load the url in the web browser); and that when there are no requests in a while, the process is killed.
I mean, when I git push my server, I would like it to start running immediately and continuously.
I read (here, for example) that this might have to do with the way iisnode manages azure websites, and that I can't do anything to change it. Is this the actual way Azure websites work? Is there any way I can deal with this?
Thanks in advance,
Bruno.
You've find the answer. There is no other answer.
The process termination because of inactivity comes from IIS - there is Idle Timeout setting. Which to my knowledge is not configurable in Azure Web Sites (at least not Free tier). Check out also this SO question and its answer to get better understanding on why you can't change this timeout on the FREE and STANDARD tiers.
And here is an interesting workaround to avoid this idle timeout. Actually if you use technique, you will also have kind-of "auto start", in terms that when your scheduler hits your site after a new deployment, it will "boot up".
This can get a little complicated, but if you don't want to use their 5-min ping service, you can keep these always on by doing the following:
Create an app setting on your website configuration tab within the portal:
WEBSITE_PRIVATE_EXTENSIONS and give it a value of 1
Create a text file named applicationhost.xdt and populate it with:
<?xml version="1.0"?><configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><system.applicationHost><applicationPools><add name="DefaultAppPool" managedRuntimeVersion="v4.5" startMode="AlwaysRunning"><processModel identityType="ApplicationPoolIdentity" /></add></applicationPools></system.applicationHost></configuration>
ftp into your website and create a folder on the root directory called Site Extensions. (there should now be 3 folders in your root: LogFiles, site, & SiteExtensions)
Create another folder within 'Site Extensions', named ASPLimits
Upload the applicationhost.xdt into the ASPLimits folder
Restart your website using the portal

Setting up cron task in Plesk 11

I'm trying to setup a cron task in Plesk to run a short script every 5 minutes, I've just moved from a managed hosting account to a full access Plesk VPS, and I'm a little lost on a couple of things, this one in particular, when I go to Server > Scheduled Tasks I get a list of 'system users' as below, but I'm not sure under which user to make the cron task, any ideas?
adm
apache
bin
daemon
ftp
games
gopher
.. going all the way down to webalizer
The cron script path is below if that's relevant as to which user to choose -
/var/www/vhosts/mysite.com/httpdocs/scripts/index.php
If you are going to create subscription-level task, than you can create cron/windows scheduler task in:
"Subscriptions" > your subscription > "Websites & domains" > click on "Show advanced operations" > "Scheduled Tasks" > there will be only one name of FTP user of your subscription.
Note: Pay attention to interface changes for Plesk 11.5 and Plesk 12+ - there is no need to open "Show advanced operations".
The latest Plesk 12.5 provide a lot of options to cover most of the task cases:
Plesk 12.5
Other Plesk versions support only "Run a command" option:
Plesk 12.0
Plesk 11.5
If you need just answer, in "Server" -> "Scheduled Tasks" you can choose:
FTP user of your subscription mysite.com
your can choose root, but it's not recommended for security reasons.
For Plesk version below 12.5 to schedule execution of PHP script on Windows there is two ways:
Direct call of php binary with your script as argument.
Path to executable file: C:\Program Files (x86)\Parallels\Parallels Panel\Additional\PleskPHP55\php.exe
Arguments: path to you script like C:\inetpub\vhosts\domain.tld\httpdocs\script.php
Note: Pay attention to interpretation path, ...Additional\PleskPHP55\php.exe it path for PHP 5.5, you can change PleskPHP55 to PleskPHP5, PleskPHP53 or PleskPHP54 to use another PHP version.
Call script via request to your site:
Path to executable file: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -c "(new-object system.net.webclient).downloadstring('http://domain.test/script.aspx')"
https://www.motherhost.com/help/creating-or-removing-scheduled-tasks-in-plesk/
Creating a Scheduled Task in Plesk 10:
You can set up Scheduled Tasks in Plesk by doing the following:
Log into Plesk*
Click on the Websites & Domains tab.
Click on Show Advanced Operations (a small grey link in the middle of the page), if the advanced options are not already shown.
Click on Scheduled Tasks.
Select the appropriate system user.
Click on Schedule New Task.
Fill out the form as follows:
Switched On: Check the box to turn on the scheduled task.
Description: A short description to remind you what this scheduled task does.
Scheduler Notification: If you want an email every time this runs, select the appropriate option, otherwise select Do Not Send. You may provide an email address where you want the notifications sent to.
Path to executable file: Specify the path to the file you wish to execute. For Windows servers, it would be something like this:
C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\php-cgi.exe
Arguments: D:\Inetpub\vhosts\mydomain.tld\httpdocs\myscript.php
For Linux servers with Plesk, ir would be something like this:
/var/www/vhosts/domain.tld/httpdocs/myscript.php
Replace domain.tld with your domain name, and myscript.php with the appropriate subfolder(s) (if any) and filename.
Task Priority: Select Low, Normal or High.
Specify when to run your command by selecting the appropriate checkboxes in the Hours, Days of month, Months or Days of week fields.
Click OK to schedule the task or click Run Now to schedule the task and immediately run it.
You will be taken back to the Scheduled Tasks screen and you should see your new scheduled task listed at the bottom.
Removing a Scheduled Task in Plesk 10
Logging into Plesk*
Click on the Websites & Domains tab.
Click on Show Advanced Operations (a small grey link in the middle of the page), if the advanced options are not already shown.
Click on Scheduled Tasks.
Select the appropriate system user.
Check the box next to the Scheduled Task you want to remove.
Click on the Remove button.
It will load a new page and ask if you really want to deleted it. Check the Confirm Removal box and click on the OK button.
You will be taken back to the Scheduled Tasks screen and it should say: "Information: Scheduled tasks were removed."
Use this command:
php -q httpdocs/scripts/index.php

Azure: How to execute startup tasks for each site entry at webrole?

We have WebRole, that hosting multiple sites. We made startup tasks for each site with some site specific actions. The problem is that only startup task of first site (first site listed in section), could be run during deployment.
Looks like this happens cause only first site (or that one from web-role defifnition) will be copied to [drive]:\approot folder at WebRole Instance. All other sites will be copied to [drive]:\sites\ (early it was another location so it could be a subject of future changes).
Is there any simple way to run batch files for each site in [drive]:\sites\ ?
Is there any tricks with RoleEnvironment object or xPath values (like here http://msdn.microsoft.com/en-us/library/windowsazure/hh404006.aspx) that can provide exact path where additional sites will be placed ?
ATM we have 2 options, both are hacky and unstable, imo:
1.Read data from IIS configuration and use it as main startup task input
2.Scan /sites/ for explicitly named scripts and execute it if found.
Startup Task is meant to be for a Role and not for a site. You have to find your way out using the RoleEntryPoint descendant and utilize its OnStart method to manually run your startup tasks per site.
As for finding out the sites directories check out this question, as the answer completly covers the task. I use it, it is 100% reliable for production.

coldfusion scheduled tasks iis permission

I am trying to use the ColdFusion administrator to schedule a task. It is returning an error which says that there are not enough permissions to execute the task.
I can successfully execute the cfm file in IE, so it's not an error with the actual file.
So from what I've read about this, it appears to be an IIS problem. Do I need to change IIS_WPG permissions on the scheduled tasks folder?
I'm wondering what permissions I need to change to be able to execute scheduled tasks. Also would be interested in best security practices.
Although I was not initially aware of this, I found out that windows integrated authentication was turned on.
I had the server admin set the IIS security on folder to anonymous access which contained the tasks. This fixed the problem.

What's a good way to deal with permissions with automated deployments across domains?

I have been working to automate some deployment processes using just Nant for the time being. Once the Nant script scripts are fairly stable and proven, I'll be looking to incorporate CruiseControl.net or similar product.
With that being said, I ran into a snag today.
I have a Nant script that will copy files from a network share that is used as a staging area to the destination (very simple to start out with). In my snag today, I was attempting to copy the files to another file share that was on a separate domain. The two domains do now have any trust between them.
The user running the Nant script had accessed both locations via Windows Explorer first to ensure that he had an authenticated session with both domains. When he ran the script, he of course got an access denied error since Nant.exe was running under the credentials of the other domain. This was an oversight on my part.
Does anyone have any recommendations on how to address this issue without touching AD?
There isn't any way that I can think of without touching AD that wouldn't be a hack. The right way to do it is to setup a service account in the domain where the nant job is running that has rights in the other domain. Then have the nant job run under the service account. The only hacky way that I can think of is to find a way to have the user with rights in both domains kick off the nant job and I'm not even positive that that would work.
It's rather hacky, but you could have a NAnt task plug in the credentials for the foreign share, either by P/Invoking WNetUseConnection or by issuing a command like
net use \\host\share password /user:user#domain
before copying the files across.

Resources