0

I am using WSL (ubuntu 20.04) on my machine. Today I learned about the at command, which can be used for scheduling jobs. I attempted to use it on WSL but the job was not fired although its time came.

Can't we use this command on WSL?

If we can, what can be the problem?

Thank you.

3

1 Answer 1

3

As with cron, the atd service is not started by default on WSL:

$ at now + 1 minute
warning: commands will be executed using /bin/sh
at> echo "Hello from at" > ~/at.log
at> <EOT>
job 1 at Thu Apr  7 08:02:00 2022
Can't open /var/run/atd.pid to signal atd. No atd running?


$ service atd status
 * atd is not running

but it may be started if you wish:

$ sudo service atd start
[sudo] password for steeldriver:
 * Starting deferred execution scheduler atd                                                                                                                         [ OK ]

then

$ at now + 1 minute
warning: commands will be executed using /bin/sh
at> echo "Hello from at" > $HOME/at.log
at> <EOT>
job 2 at Thu Apr  7 08:03:00 2022
$ atq
2       Thu Apr  7 08:03:00 2022 a steeldriver
$ atq

(queue is now empty)

$ cat ~/at.log
Hello from at

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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