I'm trying to run a command at a specific time. I've looked at the "at" command, but I don't know how to get it working...
Here's what I do:
at 1843 (Enter) php /run/this/script.php (Ctrl+D)
But how do I do this in a bash script? I mean, I need to press enter and "Ctrl+D" to set up the delay... How to do this in a script?
Any suggestions most welcome.
Thanks in advance,
the_main_thing is the command or script you want to run periodically. The purpose of [[ $0 = /* ]] && script=$0 || script=$PWD/$0 is to get the absolute path of the current script itself.
cron Special Characters. cron expressions typically contain one or more special characters that help us with scheduling tasks. Here, by using an asterisk in the last three fields (1-31 days, 1-12 months, all days of the week), our backups.sh script will run every day at 3 pm.
You can echo your command into at
as input:
echo "/usr/bin/php /run/this/script.php" | at 18:43
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With