There is an easy way to start a program during system boot. Just put this in your crontab:
The command will be executed on every (re)boot. Crontab can be modified by running
Other available Options
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
More information about crontab options is available in the man page.
How to Use percentage sign (%) in a crontab entry
Usually, a % is used to denote a new line in a crontab entry.
The first % is special in that it denotes the start of STDIN for the crontab entry’s command.
A trivial example is:
* * * * * cat - % another minute has passed
This would output the text: another minute has passed
After the first %, all other %s in a crontab entry indicate a new line.
So a slightly different trivial example is:
* * * * * cat - % another % minute % has % passed
This would output the text
Note how the % has been used to indicate a new line.
The problem is how to use a % in a crontab line to as a % and not as a new line. Many manuals will say escape it with a ‘\’. This certainly stops its interpretation as a new line but the shell running the cron job can leave the \ in. For example:
* * * * * echo '\% another \% minute \% has \% passed'
would output the text:
\% another \% minute \% has \% passed
So if you have a solution, please let me know by writing a comment.