w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Server-side scheduled tasks: need to schedule a task that happens with a frequency of 5 seconds
I'm not sure if this is conventional (?) but... Use a database trigger on INSERT that runs an external program (PHP, Python, .. whatever). Which database are you using? I think this post is old but might be of help: http://crazytechthoughts.blogspot.co.uk/2011/12/call-external-program-from-mysql.html

Categories : PHP

Scheduled polling task in Go
// Type with queue through a channel. type MyType struct { queue chan []*net.URL } func (t *MyType) poll() { for urls := range t.queue { ... time.Sleep(30 * time.Minute) } } // Create instance with buffered queue. t := MyType{make(chan []*net.URL, 25)} go t.Poll()

Categories : Go

Creating a new scheduled task using powershell v1.0
to create a new task I usually create it manualy on one server then export it to .xml, with the following code you can import it on another server ( i've not verified this is working in V1.0 though) $sch = New-Object -ComObject("Schedule.Service") $computername | foreach{ $sch.connect($_) $root=$sch.GetFolder("") $root.CreateFolder("SMAC") $folder =$sch.GetFolder("SMAC") Get-childItem -path $task_path -Filter *.xml | %{ $task_name = $_.Name.Replace('.xml', '') #create a task base on the name of the xml file $task_xml = Get-Content $_.FullName $task = $sch.NewTask($null) $task.XmlText = $task_xml $folder.RegisterTaskDefinition($task_name, $task, 6, $cred.UserName, $cred.GetNetworkC

Categories : Powershell

Scheduled VBA task and 'Application.OnTime'
The Application.OnTime part is right and FindMissingValue.AutoFindMissingValue should be called without any problem (after 5 seconds). What might happen is that, during this 5 seconds period, the code continues running, goes back to where AutoPrintMissingHistoric was called from, and the workbook might be closed before these 5 seconds have passed (although, depending upon your exact conditions, the function should be called even despite the workbook is closed). You can either reduce the waiting period (vDelay = 1, for example) or just call the function directly (Call FindMissingValue.AutoFindMissingValue). Actually, I am not sure why you are calling the function by relying on Application.OnTime; using this is fine for "starting the process" (e.g., "I want my macro to be executed every day

Categories : Excel

VB.net Perform task at scheduled Time
You dont have to loop, Simply add a Timer to your form, set its interval to 500 so that it fires every 500 milliseconds. Enable it via a Button to start your Task. Then on your Timer.Tick Event: Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If Hour(Now) = HourChoice And Minute(Now) = MinuteChoice Then 'Your Task Here End If End Sub

Categories : Vb.Net

how to run task at scheduled time with RabbitMQ
RabbitMQ is not a task scheduler, even though the documentation talks about "scheduling" a task. You might consider using something like cron. You could also use a library like sched to build a scheduler in a Python process. FYI It looks like this question has already been answered: Delayed message in RabbitMQ

Categories : Python

.NET program which can be called from ASP.NET and run as a scheduled task
If you have access to the GAC on the server, then just abstract the code out of the EXE and into a library assembly. Add the library DLL to the GAC. Then reference that DLL from both the EXE and the Web project. If you don't have access to the GAC you can still do it, just deploy the DLL with the EXE and in your web app's bin. EDIT here's how to create a library assembly http://broadcast.oreilly.com/2010/07/understanding-c-namespaces-and.html

Categories : Asp Net

Testing to see if a scheduled task exist in powershell
When used in a double-quoted string, variable evaluation will stop at punctuation. You can use $() to denote a subexpression within a string, like this: "TASK: $($task.name)" PowerShell will then evaluate the expression inside the parentheses and expand the string with the outcome

Categories : Powershell

SSIS script task not working when scheduled
I believe that the reason it won't work is that when you run the SSIS task as a scheduled job it doesn't run in the context of your account but rather the service account for the SQL Server Agent and the message box won't show for you. The messagebox isn't valid for a non-interactive task.

Categories : Sql Server

Scheduled Powershell task can't interact with browser
I had a few problems trying to do the very same, The powershell script is running in another session/context (as i read here Powershell scripts manipulating desktop elements don't work with Scheduler). Therefore you cant use the gui. My solution was to use this (new-object -com wscript.shell).run("http://localhost/",3) This opens a local website, full screen and focused in the default web browser. after this, you can use the sendkeys. As a side-note, if i was to use the AppActivate,i would start securing that it is really the process i just started, by capturing and using the ID instead. $iex = Start-Process 'C:Program Files (x86)Internet Exploreriexplore.exe' -passthru 'http://localhost/' start-sleep 3 [Microsoft.VisualBasic.Interaction]::AppActivate($iex.Id)

Categories : Powershell

why is my scheduled task haveing a long delay in between
Perhaps you'll see such behavior if the task takes longer to run than the allotted window. The scheduler may not initiate a new one of the previous one is not complete. The other issue might be accuracy. I don't know if you can guarantee execution every 50 ms.

Categories : Java

Django setting up a scheduled task without Cron
Django doesn't do scheduled tasks. If you want scheduled tasks, you need a daemon that runs all the time and can launch your task at the appropriate time. Django only runs when a http request is made. If no one makes a http request for a month, django doesn't run for a month. If there are 45 http requests this second, django will run 45 times this second (in the absence of caching). You can write scripts in the django framework (called management commands) that get called from some outside service (like cron). That's as close as you'll get to what you want. If that's the case, then the question/answer you reference is the place to get the how tos. Probably on a unixy system, cron is the simplest outside service to work with. On recent linux systems, cron has a directory /etc/cron.

Categories : Django

.net application failing when fired via scheduled task
It seems like a permissions issue to me. Running the code inside VS is way too different to running it on its own. VS takes care of most of the stuff and makes life easy for the developer. Can you please check if the account you are using to run the scheduled task has permission to access the network path?

Categories : C#

how to have a variable that will available to particular scheduled task whenever it runs again after some time?
there multiple ways to do that. I'll detail some of those, going from ugly to somehow elegant. Solutions tested against Ruby 1.9.3p392 on Debian GNU/Linux 7 with rufus-scheduler 2.0.23 (https://rubygems.org/gems/rufus-scheduler). You could use a global variable: require 'rufus-scheduler' scheduler = Rufus::Scheduler.start_new scheduler.every '1s' do $counter0 ||= 0 $counter0 += 1 p [ :c0, $counter0 ] end scheduler.every '1s' do $counter1 ||= 0 $counter1 += 1 p [ :c0, $counter1 ] end scheduler.join Or you could centralize the job variables in a single global variable (note: this isn't thread-safe): require 'rufus-scheduler' scheduler = Rufus::Scheduler.start_new $job_vars = {} scheduler.every '1s' do |job| ($job_vars[job.object_id] ||= {})['counter'] ||= 0 $job_v

Categories : Ruby On Rails

Scheduled task keeping application alive
Calling shutdown() on the scheduledExecutorService allowed the program to shut down normally. scheduledExecutorService.shutdown(); According to the javadocs, Initiates an orderly shutdown in which previously submitted tasks are executed Whereas calling cancel(true) just cancels the task, leaving the executor service alive, shutdown() kills the executor service as well, allowing the program to exit.

Categories : Java

Scheduled task agent wp7 soap client does not work
Your client.UserTrackAsync is an async call. The problem is that NotifyComplete(); is executed before client.UserTrackAsync has a chance to finish. You need to call it in the UserTrackCompleted handler (and delete it from the original place): client.UserTrackCompleted += (sender, args) => { var res = args.Result.Retval; NotifyComplete(); };

Categories : C#

.exe running as scheduled task doesn't write to file
I would consider changing the folder where your text file lives, WINDOWS folder is a very protected area and changes to files that already exist there can only be made under elevated status (admin permission). My guess is that your scheduled task isn't elevated like it should be for altering files in that folder.

Categories : C++

scheduled task response to channel spring-integration
Use an inbound-channel-adapter instead <int:inbound-channel-adapter ref="loadfruits" method="loadFruits" channel="outboundComplexChannel"> <int:poller cron="0/5 * * * * *"> </int:inbound-channel-adapter>

Categories : Java

Scheduled Task in Fragment returns getActivity as null
FragmentManager sets the fragment's mActivity field shortly after onAttach() and sets it to null shortly after onDetach() (see the source code), so my guess is that you are trying to execute getActivity() either too early or too late in the fragment lifecycle.

Categories : Android

Unable to print PDFs or office documents via Scheduled task
I'm trying to do the same thing that you are attempting. I'm pretty sure what you're running into is session 0 isolation. You can read more about it at this MSDN site and this Windows blog post. I haven't tried the suggestions in the following answer to another question on SO, but it might be worth a try. Creating Desktop-Folders for session 0 Here is another guy who is trying to print without having a user logged into the machine. There is an answer from someone who claims to know how to do what we're all trying to do, but he doesn't actually post the answer.

Categories : Powershell

taskkill has no effect when issued under scheduled task while user is logged off
Try to change the file extension of your batch file to '.cmd' instead of '.bat' and make sure your file is ANSI encoded instead of UTF-8 (the UTF-8 Byte Order Mark i.e. BOM could make your batch file invalid and throws an unrecognized character at position or line x error). I use Notepad++ for this kind of encoding checks / conversions.

Categories : Misc

Different user.config file when application is running as scheduled task
Yes, this is normal: when debugging the config file for yourapp_vshost.exe is used which is clearly a different exe, so has a different config. A simple solution is to create a link from one file to the other: mklink first/path/user.config second/path/user.config you might have to use mklink /H if the app isn't happy with it. Or first start your exe without debugging, then attach to it. Or deselect Enable the Visual Studio hosting process in your project's config, which will get rid of the yourapp_vshost.exe (see here to check if you need it. Bascially you don't if you don't use the designer..)

Categories : C#

Will A java run task scheduled with scheduleWithFixedDelay be stoped during Stop-The-World GC?
Yes, stop-the-world is exactly what it says it is - every thread that accesses objects on the heap that is not specifically involved with the garbage collector is stopped. If you want a heartbeat in java, best to farm out to a separate VM running just that code so the VM pauses are not so long. Or better still, not rely upon millisecond timing - you can't assume that level of scheduling amongst processes in desktop OSs.

Categories : Java

How to create a Scheduled Task via Invoke-command when Blanks in a Path are involved?
Try using the single quote around the path with spaces and it will work. Invoke-Command -session $mysession -ScriptBlock { schtasks /create /RU myuser /RP mypasswd /TN "Temp Task Copy-Item" /TR "powershell -ExecutionPolicy Bypass -command copy-item -path \192.168.1.1shareFolder -Destination 'C:Program Files (x86)Temp'" /SC ONCE /ST 22:35}

Categories : Powershell

How to start, pause, continue a task that executes every 5 seconds as a "keep busy" task
I suggest you make the problem much simpler. Have a recurring task which starts ever 5 seconds. the first thing does is check a volatile flag and if set, returns without doing anything. To turn this process, unset the flag. To pause it, set the flag. You task can do more than one thing. If it needs to do an R2 after T finishes, you can check for this and execute it in the same task. There is no need to create another task as such. Note: if you add R2 to the same ExecutorService as T, it has to wait for it to finish before it can start R2. This single threaded service can only do one thing at a time.

Categories : Java

PowerShell code running as scheduled task fails with Program Files folder
Maybe the execution policy is too restricted for this account. try to set the executionpolicy by adding -executionpolicy unrestricted in the parameters. If that failed, it would help to see the log of the scheduler.

Categories : Powershell

await Task.Factory.StartNew(() => versus Task.Start; await Task;
StartNew is just a short hand for creating and starting a task. If you want to do something to the Task instance before you start it, use the constructor. If you just want to create and start the task immediately, use the short hand. Documentation for StartNew says: Calling StartNew is functionally equivalent to creating a task by using one of its constructors, and then calling the Task.Start method to schedule the task for execution.

Categories : C#

How to start a scheduled thread when no much requests comming to the web application?
Use a javax.servlet.Filter with a static counter, incremented and decremented by the filter. This way you know the current load (= number of requests being processed currently) Use @Startup with @Singleton and @Schedule to have a regular task (or any other scheduler like Quartz), for example every 5 minutes In that task check the load. If it's low, enough start the real task(s). You could monitor the current load in running tasks as well, and pause or exit, for example. This works, if the real task is processing the contents of a queue for example. Otherwise you possibly have to do some book-keeping, if the frequency of the first task is higher than the frequency of the real task or you have to make sure that the real task is only run once per day (or at least once a day). Example cod

Categories : Java

Is there any way, given user permission, for an android app to start on its own at a scheduled time in the future?
You can use the Alarm Manager. This class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. http://developer.android.com/reference/android/app/AlarmManager.html

Categories : Android

Spring Scheduler - When there is a cyclic dependency, scheduled method doesn't start in transaction
You can achive this using @PostConstruct @Component class Manager { Util util; public void setUtil(Util util) { this.util = util; } } @Component class Util { @Autowired Manager manager; @PostConstruct public void init(){ manager.setUtil(this); } @Scheduled(fixedDelay = 1 * 60 * 1000) @Transactional(propagation = Propagation.REQUIRED) public void scheduledMethod(){ // Need to update the database in a transaction } }

Categories : Java

Simple c++ program fails to run as a scheduled-task (interactive/non-interactive issue?)
If i may answer my own question, This, appears to be some sort of security measure by windows to avoid receiving keyboard/mouse events from outside of users desktop (See here).

Categories : C++

Starting VB Script from Powershell script - works from PS environment, but not scheduled task
Try running this batch script as a scheduled task: @echo off setlocal set "programdir=C:Program Files (x86)LNGoogleCalSync" set "script=%programdir%lngsync.vbs" pushd "%programdir%" wmic process get commandline | findstr /r [l]ngs >nul || cscript "%script%" popd If that doesn't work: try replacing all MsgBox statements in the VBScript with WScript.Echo.

Categories : Powershell

Sql Server 2000 create scheduled job to run stored procedure
Open SQL Server Enterprise Manager. Expand the Management node. Right Click Job from the Sub Nodes and Select New Job from the context Menu. You can use THIS to create the jobs.

Categories : Sql Server

Use Azure Mobile Service Scheduled Task to Access Azure Service Management REST Api
Management certificate is just a standard certificate file (.cer) (X.509 v3). You can put the contents in a string (Don't kill me for suggesting this) or a table which your script would read. Once you have the certificate content in hand as a string, you can attach it to the HTTPS request you are making to the Azure service management API. Nate Good has a nice post on how to achieve this with nodejs. He is reading the certs from files, so you'll have to change that part and replace it with your cert strings.

Categories : Node Js

"launchctl start error: Bad file descriptor" when trying to start Neo4j server
I had to remove it from launchd and then it would work, like this: balinjdl-mac:local balinjdl$ neo4j start WARNING! You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7. Using additional JVM arguments: -server -XX:+DisableExplicitGC Dorg.neo4j.server.properties=conf/neo4j-server.properties Djava.util.logging.config.file=conf/logging.properties Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew Detected installation in launchd, starting it... launchctl start error: Bad file descriptor balinjdl-mac:local balinjdl$ neo4j remove balinjdl-mac:local balinjdl$ neo4j start WARNING! You are using an unsupported version of the Java runtime. Please use Oracle

Categories : Osx

Async Task does not start from non activity
The get() method blocks the UI thread which means onPreExecute can't run (it has to run in the UI thread) Thus the background thread will never be started. Get rid of the call to get() and move the "return the value" logic to onPostExecute. And NEVER block when you are in the UI thread.

Categories : Android

Start MongoDB from within a Grunt task
You can use grunt-shell to run the command: grunt.initConfig({ shell: { mongo: { command: 'mongod' } } });

Categories : Mongodb

celery how to terminate and start again task
Possibly an easier way to achieve this would be to implement that logic inside the task itself: You don't have to revoke the Task, just don't do anything in it Your Task can just submit a new, updated, Task to the Queue

Categories : Python

ant task to delete files and directory that start with the same name
Use a fileset to select files with a pattern, a dirset to select directories with a pattern. This should do the job: <delete> <dirset dir="${basedir}" includes="test*" /> <fileset dir="${basedir}" includes="test*" /> </delete>

Categories : Ant

Other ways to start a task in an asynchronous manner
If you are using .Net 4.5 var task = myReq.GetResponseAsync(); For .Net 4.0 you can write something like this public Task<HttpWebResponse> GetAsync(HttpWebRequest req) { var tcs = new TaskCompletionSource<HttpWebResponse>(); req.BeginGetResponse(e => { if(e.IsCompleted) tcs.TrySetResult((HttpWebResponse)req.EndGetResponse(e)); }, null); return tcs.Task; } But I don't see anything better than your current code.

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.