Saideep Pavuluri
Saideep Pavuluri

Reputation: 102

How to schedule a command only once without 'at' and using 'crontab'

I would like to run a command (simulation) after 6 hours only once.

I came across "at" to do my job but unfortunately I have no rights to install the package.

I also came across "crontab" which takes time and date as parameters.

In my case, I would just like to run the simulation command once after 6 hours. Is this possible using crontab or am I being too ambitious?

Appreciate if you hint me at any other alternative.

Upvotes: 1

Views: 183

Answers (1)

Jim Lewis
Jim Lewis

Reputation: 45035

You could make a shell script that sleeps for 6 hours, then executes your command. Run it "now" and your command will execute once, six hours later.

#!/bin/bash

sleep 6h  # or, "sleep 21600" if your system doesn't support the "6h" syntax
yourcmd

Upvotes: 1

Related Questions