You can use a trick like this to avoid executing the script more than once:
#!/bin/bash
test ! -e /path/to/chosen/file || exit 0
touch /path/to/chosen/file
echo "Executing my job"
You can run the above script only once. Other executions will exit because the file should be created in the first execution. Of course, you need to have enough permissions to create the file.
To keep this valid after reboot, you need to avoid creating the file under a temporary file system like /tmp. Also, this prevent multiple execution of the script regardless of whether it is executed manually or part of startup process.
You can use a trick like this to avoid executing the script more than once:
You can run the above script only once. Other executions will exit because the file should be created in the first execution. Of course, you need to have enough permissions to create the file.
To keep this valid after reboot, you need to avoid creating the file under a temporary file system like
/tmp
. Also, this prevent multiple execution of the script regardless of whether it is executed manually or part of startup process.There are a few tools within the oem-config packages to carry out initial configuration immediately following installation.