The at command is a scheduler that accepts lines from stdin or files that contain commands to run at a specific time. Your example:
echo '/usr/bin/php command'| at now
Gives the 'at' command to your command as a string and plans to run it immediately.
The first method is a typical background process through a shell:
/usr/bin/php command >/dev/null 2>&1 &
The "> / dev / null" part tells the shell to send your command stdout file to / dev / null, and the "2> & 1" part says to send the stderr output of your command to stdout (which then goes to / dev / null) . Together they suppress the exit. You can do this in one step:
/usr/bin/php command &>/dev/null &
The "&" at the end is what the shell says to execute the background process.
The advantages of using 'at' is the flexibility of planning your team to launch at a different time than now (by the way). Read the man page. The disadvantages are that it cannot be installed on all systems.
The advantages of using and using shells are that there are no overheads based on the background. Using the βatβ command to run the command immediately causes excessive overflow because it involves creating a new process, scheduling the command, knowing that it is configured to run, and then running it in the background. Whereas the & command in the shell will just run this command in the background.
source share