I'm trying to create a service which runs several scripts using ExecStart
and some of them can be failed. I need to ignore these failed scripts and return a success for the service.
Previously I used upstart
and this is how I achieved it.
start on runlevel [23]
stop on shutdown
script
set +e # Disable exit on non 0
stop sys_process_script
start sys_init_script
start sys_process_script
set -e # Enable exit on non 0
end script
But I don't know how to ignore the failed script. This is my implementation so far.
[Unit]
Description=System starter
[Service]
Type=forking
ExecStart=/bin/systemctl stop sys_process_script
ExecStart=/bin/systemctl start sys_init_script
ExecStart=/bin/systemctl start sys_process_script
Is there any method to ignore the script if failed in systemctl
or in .service - onFailure
?