The company's business mainly does data backup (supports incremental file backup), so during testing, new files need to be generated regularly to test whether the business is operating normally.
Add the following script file to crontab to generate new files regularly. The principle of the script is mainly to use the dd command to create a file of a specified size.
<?php $timestamp = time(); $id = uniqid(); $filename = "/tmp/{$timestamp}.img"; $cmd = "dd if=/dev/zero of=$filename bs=4m count=5; echo $id >> {$filename}"; exec($cmd, $ret, $output); ?>
The above introduces the PHP script to create a file of a specified size regularly, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.