0

I desire to run a particular task 2 hours ahead from now.

In Bash 4.3 in Ubuntu 16.04 I executed:

tdm() {
    chmod -R a-x,a=rX,u+w "$drt"/phpmyadmin/
    echo "chmod -R 000 "$drt"/phpmyadmin/" | at +2h
}
tdm

I get:

syntax error. Last token seen: +

Garbled time

Maybe I should put current time in a variable X somehow and define "at 2 hours from time X"?

I didn't understand the answer here.

Arcticooling
  • 1
  • 12
  • 44
  • 103

1 Answers1

3

According to the at manual on Ubuntu, the format of the time specification can be on the form

now + count time-units, where the time-units can be minutes, hours, days, or weeks

This means that you should use

at now + 2 hours

to execute the command "in two hours time from now".

Kusalananda
  • 320,670
  • 36
  • 633
  • 936