| 1 | Service Wrapper Scripts |
| 2 | ======================= |
| 3 | |
| 4 | If your service requires to run additional commands, executed before the |
| 5 | service is actually started, like the systemd `ExecStartPre`, you can |
| 6 | use a wrapper shell script to start your service. |
| 7 | |
| 8 | The Finit service `.conf` file can be put into `/etc/finit.d/available`, |
| 9 | so you can control the service using `initctl`. Then use the path to |
| 10 | the wrapper script in the Finit `.conf` service stanza. The following |
| 11 | example employs a wrapper script in `/etc/start.d`. |
| 12 | |
| 13 | **Example:** |
| 14 | |
| 15 | * `/etc/finit.d/available/program.conf`: |
| 16 | |
| 17 | service [235] <!> /etc/start.d/program -- Example Program |
| 18 | |
| 19 | * `/etc/start.d/program:` |
| 20 | |
| 21 | #!/bin/sh |
| 22 | # Prepare the command line options |
| 23 | OPTIONS="-u $(cat /etc/username)" |
| 24 | |
| 25 | # Execute the program |
| 26 | exec /usr/bin/program $OPTIONS |
| 27 | |
| 28 | > [!NOTE] |
| 29 | > The example sets `<!>` to denote that it doesn't support `SIGHUP`. |
| 30 | > That way Finit will stop/start the service instead of sending SIGHUP |
| 31 | > at restart/reload events. |