1

I need a way to create an entry on the crontab that executes a script only once in 24h.

Steps:

  • Run a bash script to configure a crontab to run a script in 24h (with command date?). This will run only ONCE 24 hs after .
  • 24h later the script runs.
  • At the end of the script execution, the crontab must be left clean. This means to remove the entry from the crontab. I don´t want to pollute the crontab with deprecated entries.
4

1 に答える 1

4

crontab を汚染したくない場合は、「at」を使用できます。

at now + 24 hours

「at>」プロンプトが表示され、24 時間後に実行されるコードを入力できるようになります。

次を使用してシェルスクリプトを実行することもできます。

at -f shell_script now + 24 hours

追加情報はこちらにあります: https://en.wikipedia.org/wiki/At_(Unix)

そしてここ: http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/scheduling.html

于 2016-12-20T10:42:51.887 に答える