0

I want in terminal or in crontab(both) be able to put a random time.

Something like

Sleep $(1-300)  pkill screen && ./start

just a random simple example

Local Host
  • 21
  • 1
  • 4
  • in bash shell, this will give you a random number good enough for your question as asked: `$(( RANDOM % 300 ))` – JDS Sep 18 '18 at 21:05

1 Answers1

1

You can sleep for 1 to 300 seconds using the following command :

sleep $(( ( RANDOM % 300 ) + 1 ))

So, to run a command just after that, use sleep $(( ( RANDOM % 300 ) + 1 )) && your command

This answer assume you are using bash

WayToDoor
  • 126
  • 6