Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am writing a bash (.sh) script for cygwin. I want to run a certain command at specific time.

I tried the following:

echo "test" | at 19:00

but I get the following error:

The AT command has been deprecated. Please use schtasks.exe instead.

So can I only use Scheduled Task in Windows for this?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

The at command from Unix is not available on Cygwin. Cygwin has traditionally used the at command from windows, but this has been deprecated in favour of schtasks.exe.

So the answer to your question is yes: you can only use Scheduled Task in Windows for running a task once.

(You can use cron and set it on a specific date at a specific time... but it will repeat every year unless you remove the task from the crontab.) ;-)

share|improve this answer

You can instead add a cron job.

Login from the user from which you want to execute the bash script.

Execute crontab -e command.

Now suppose if you want to run the bash script exactly on 19:00 on daily basis, then you need to add a line like this:

00 19 * * * /path/to/bash/script

Note: That script must have executable bit set for that user.

share|improve this answer
    
hmm... it does recognize crontab -e command. I looked it up online, it is my understanding that I need a cygrunsrv package for this –  l3win Apr 12 '13 at 15:55
    
Cron is for periodic jobs. This question is about a once-off. –  Gilles Apr 12 '13 at 21:55
    
The answer is ok but you have to install the cron package first (using setup.exe of cygwin) . –  DavAlPi May 24 '13 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.