To execute a cron job after system reboot on Linux, you can add a cron job to the root crontab that runs at reboot.
Here are the steps to create a cron job to run after system reboot:
- Open the root crontab file for editing using your preferred text editor. You can use the following command to open the crontab file in the vi editor:
sudo crontab -e
- Add the following line to the crontab file:
Replace
/path/to/your/script
with the path to your script that you want to run after system reboot. - Save the changes to the crontab file and exit the editor.
The cron job will now run your script after the system reboots. You can check the logs to confirm that your script has run successfully.