Do you want to run the bash script as root, but delay it. How can this be achieved?
sudo "sleep 3600; command" , or sudo (sleep 3600; command)
does not work.
You can use at :
at
sudo at next hour
And then you need to enter the command and close the file with Ctrl + D. Alternatively, you can specify the commands to run in the file:
sudo at -f commands next hour
If you really need to avoid using cron: sudo sh -c "(sleep 3600; command) &"
What about:
sleep 3600; sudo <command>
In any case, I would consider using cron in your case ...
Source: https://habr.com/ru/post/890663/More articles:ConditionalAttribute and other special classes - compiler-constructionsun.net.www.http.HttpClient memory leak in Tomcat 6 - memory-leaksCreating continuous splines / Ensuring a smooth transition between splines - mathHow to track NSSystemClockDidChangeNotification in iPhone SDK - timeInstalling the vaadin eclipse plugin - eclipseC # multithreading request - multithreadingHow can I make this matrix fill function R faster? - matrixDo Google and Bing crawlers process hash tags in URLs as GET parameters? - seoDjango APPS Blog - djangoHow can I check the validity of a .mo file? - phpAll Articles