I have a Shell command that I'd like to run in the background and I've read that this can be done by suffixing an &
to the command which causes it to run as a background process but I need some more functionality and was wondering how to go about it:
service apache2 start
.How can I go about this? Is there a tool that allows me to run a command as a service?
I'm a little lost with this.
Thanks
Take a look at the daemon command, which can turn arbitrary processes into daemons. This will allow your script to act as a daemon without requiring you to do a lot of extra work. The next step is to invoke it automatically at boot. To know the correct way to do that, you'll need to provide your OS (or, for Linux, your distribution).