Greetings, I am attempting to learn to use systemd. I have an IPtbales script I intend to transform from a bash script to a systemd service file.
It has lines such as iptables -A INPUt -p tcp ......-j ACCEPT which I intend to transform to ExecStart=iptables -A INPUT -p tcp ......-j ACCEPT however it has 'conditionally-processed lines like these if [ something=1 ]; iptables -A INPUT -p tcp ......-j ACCEPT fi where $something is an environmental variable set in an external file. I read hrough the systemd manual page on unit files ( http://www.freedesktop.org/software/systemd/man/systemd.unit.html ) and the closet match I see is the use of two lines ConditionFileNotEmpty=SomeFile ConditionNull=0 where I presume one could create 'SomefFile' with something in it to trigger a logical 0 so avoiding processing the service file. If I am not wong this would only relate to the processing of a service file that that THIS unit file relates to. And this would conflict with my requirement as I want ONE largish IPtables service file. The question is; is there a way of conditionally procesing lines in systemd service files such as the following ExecStart=/path/to/executible1 ExecStart=/path/to/executible2 some condition satisfied ( for example ConditionFileNotEmpty=SomeFile ..... ) ExecStart=/path/to/executible3 ..back to 'unconditional processing ExecStart=/path/to/executible4 I also read through the service file manual-page ( http://www.freedesktop.org/software/systemd/man/systemd.service.html ) and I am wondering if ExecStartPre= and ExecStartPost= could be used and if so how so Advice will be appreciated sincerely luxInteg _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
