I was reading a tutorial in bash where they said to restart the machine, there was no option to restart a service directly, it was a matter of restarting the machine, and then t
I've never done this, but if I had to I would split the script into two pieces, one before restart that includes the restart command, then another that's post install.
The first one would also create a lock file.
The overall script would run the first script if the lock file didn't exist or run the second one if the file exists. This overall script would be set up for startup.