Tag Info

Hot answers tagged

88

You could run it silently using a Windows Script file instead. The Run Method allows you running a script in invisible mode. Create a .vbs file like this one Dim WinScriptHost Set WinScriptHost = CreateObject("WScript.Shell") WinScriptHost.Run Chr(34) & "C:\Scheduled Jobs\mybat.bat" & Chr(34), 0 Set WinScriptHost = Nothing and schedule it. The ...


51

Congratulations! You've come up against a problem that has stumped many a Windows user/admin. No, you cannot rename a task except for exporting, renaming and importing again. Yes, it's rather silly. Perhaps an enterprising scripter could create a simple PowerShell script that automates this, but until then, you're stuck with your export/import two-step. ...


44

Are you running this as a scheduled task? If so set it to run as a different user account then it won't be visible to the logged on user. If the script needs no network access to items that need windows auth (like file shares or printers), you can run it as "nt authority\system" and leave the password blank. On Windows 7, just set the user to SYSTEM, and ...


25

If it is one-time deal, you can use shutdown command with -r as argument. Instead of using shutdown now, you can add time as parameter (e.g. shutdown -r 12:30).


23

The problem isn't really with cron - it's with your job. You will need to have your job interact with a lock of some description. The easiest way to do this is have it attempt to create a directory and if successful continue, if not exit. When your job has finished and exits it should remove the directory ready for the next run. Here's a script to ...


20

The SQL Server Agent will do it for you. There is even a user-friendly wizard available to create the necessary backup jobs (SQL Server 2005 Books Online: How to: Create a Maintenance Plan). In terms of reliability - I would expect this to be rock-solid. It can execute multiple-step jobs at complex schedules and notify you by mail or other means or start ...


19

Create an @reboot entry in your crontab to run a script called /usr/local/bin/runonce. Create a directory structure called /etc/local/runonce.d/ran using mkdir -p. Create the script /usr/local/bin/runonce as follows: #!/bin/sh for file in /etc/local/runonce.d/* do if [ ! -f "$file" ] then continue fi "$file" mv "$file" ...


18

As far as I know there is no way to synchronise scheduled task passwords. The common practice for this sort of thing is to create a service account for running the task and set the password not to expire. You can use a long and complex password for this as you're only likely to use it once then forget about it.


16

If you modify the user file under crontabs, it should work. However, there are two issues to take into consideration: If you mistyped the cron entry in the file, you will not be warned as opposed to using crontab -e command. You can not edit your user file under crontabs directly without login as root or using sudo. You will get permission denied error. ...


15

You could also try CHP (Create hidden process), does exactly what you'd think... CHP.EXE mybat.bat Runs with no command window. Perfect! Made by the same people as CMDOW, but this is more appropriate.


13

Assuming you're just setting the task to "Repeat" in the XP "Scheduled Tasks" system, no further action on your part is needed. Scheduled Tasks won't "Repeat" a task if it's already running. If you want to override that default, you can check the box "If the task is still running, stop it at this time" to cause the task scheduler to kill the last instance ...


13

Putting files in cron.d is enough. However, your last entry should be: */10 * * * * php /var/www/site1/helper post:update Otherwise it runs once an hour, at the 10th minute.


13

I have a program that is launched on system startup using Task Scheduler on Windows Server 2012. The program must start even if the computer reboots automatially. Then why do you not make it a system service, as the windows specs define? How can I solve this? You can not. Background programs are not supposed to interact with the UI. Or: the UI ...


12

I really appreciate the effort put into Dennis Williamson's answer. I wanted to accept it as the answer to this question, as it is elegant and simple, however: I ultimately felt that it required too many steps to set up. It requires root access. I think his solution would be great as an out-of-the-box feature of a Linux distribution. That being said, I ...


12

It appears that there is more than just "regular" process priority at work here. As I noted in the question, the task scheduler by default runs your task at lower than normal priority. This question on StackOverflow describes how to fix any task to run at Normal priority, but the fix still leaves one thing slightly different: memory priority. Memory priority ...


12

Add the following to root's crontab: 0 0,12 * * * /sbin/init 6 But honestly, why on God's green earth would you want to reboot every 12 hours?


12

I have no authoritative reference but I have just tested the behavior of multiple different Stop conditions in Task Scheduler on both Windows 8.1, Server 2008 R2 and 2012 R2. They both apply! Whichever stop condition is met first, stops the task The "Stop task if it runs longer than"-condition speficied in the Trigger, will only apply when the task has ...


10

Looks like they were discussing the problem here: http://social.technet.microsoft.com/Forums/en-US/itprovistamigration/thread/76b6276b-49f2-41e2-b4ea-f537e0eb88a8 Seems like there is no current approved method of doing this. However one user in that forum posted this: If you run schtasks from the vista/2008 server maching you can export the xp/2003 ...


10

This should work so long as the account you run the scheduled task using has correct access to the network share where the bat file is located. Depending on what the script does, I'd stagger the run times by department. You only need a minute or two of variance to minimize the odds of a staggering hit right at 12. Regarding the commenter above who mentions ...


9

I had this same requirement. In Server 2008, you can actually modify the Repeat task every: dropdown. By default the lowest value is "5 minutes", but you can simply type "1 minute" in there. You can verify this by looking at the Triggers tab and seeing that it says "... repeat every 00:01:00...". You can also try typing in "10 seconds" and you'll get an ...


9

I'd personally let the server run or move it to a better running environment. This may not be worth automating. If you must shut down the entire host, please make sure that your VMs have the VMWare tools installed (to allow graceful shutdown and power up) and that they're set to stop and start with the host. You can use the vCli and schedule a cron job to ...


8

CMDOW is an awsome tool that allows you to do many, many things to windows from the command line. One of the simplest things to do is hide the current window (usually as a first line in the bat file) with: cmdow @ /hid or start a new hidden process with cmdow /run /hid mybat.bat


8

I'm assuming that the program needs to display its UI and that you can't just run it non-interactively. (I love these "gems" of software...) Here's what I'd do, personally: Configure the server computer with an AutoAdminLogon as the user you want to run the application as. This will cause the server's console to logon as this user automatically on boot. ...


8

As Ryan Ries pointed out, 2147942402 translates to "File not Found" - which is a very appropriate response. Try and press Win+R, put in "move" and press enter - that's the interactive equivalent of what your task is failing to do. The reason is that MOVE is not a program, but a native command in cmd. It should be: Program: "cmd.exe" Arguments: "/c move ...


7

Your syntax should be 0 */4 * * * <command> A * in the minute field causes it to run every minute, as you're experiencing. A zero will cause it to run at 0 minutes past the hour, every 4 hours. Not sure why you can't restart cron; perhaps your cron job is DoS'ing your machine.


7

Ideally, you shouldn't be running scheduled tasks using the built in administrator accounts My advice would be to create a service account and use that for your scheduled tasks. A service account is just a normal AD user, but usually has: 1) A VERY strong password (The kind you can't remember) 2) A meaningful name (E.g. svc_backup) 3) Password set to ...


7

Here's how I've got one of those tasks set up. (Every three hours instead of one, but you should get the gist.) Task runs daily, repeats every x hours for... all day.


7

Don't use a drive letter, use a UNC path, so if Z:\ is \\server\shares then just have your batch copy to \\server\shares\folder instead of Z:\folder.


7

You would want to set the trigger to On a schedule to look like this below. The task will start at 4PM and continue until 2PM where it will stop for 2 hours, and continue again.


7

You can use the COM-based Task Scheduler Scripting objects: ($TaskScheduler = New-Object -ComObject Schedule.Service).Connect("localhost") $MyTask = $TaskScheduler.GetFolder('\').GetTask("My Task") $MyTask.Enabled = $false To enable the task again: $MyTask.Enabled = $true The above will only work if the shell is elevated and you are a local ...



Only top voted, non community-wiki answers of a minimum length are eligible