Systemd: Difference between revisions
From Leo's Notes
This page was last edited on 23 March 2015, at 01:27.
Created page with " == SystemV-like Init Scripts == If you have custom packages that make use of the old SystemV startup scripts, you can use the following files to make use of such scripts. I..." |
No edit summary |
||
| Line 26: | Line 26: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
#!/bin/sh | #!/bin/sh | ||
StartupDir="/usr/local/boot/startup" | |||
# | # Run all scripts starting with 'S' | ||
for i in `ls $StartupDir/S*` ; do | for i in `ls $StartupDir/S*` ; do | ||
ScriptName=`basename $i` | ScriptName=`basename $i` | ||
sh $StartupDir/$ScriptName | sh $StartupDir/$ScriptName | ||
done | done | ||
# Success exit code. | |||
exit 0 | |||
</syntaxhighlight> | |||
Make the directory: | |||
mkdir -p /usr/local/boot/startup/ | |||
Then place your scripts in the startup directory starting with the letter 'S'. | |||
[[Category:Linux]] | [[Category:Linux]] | ||
Revision as of 01:27, 23 March 2015
SystemV-like Init Scripts
If you have custom packages that make use of the old SystemV startup scripts, you can use the following files to make use of such scripts.
In /etc/systemd/system/cpsc-initd.service
[Unit]
Description=CPSC SystemV-like startup scripts
ConditionFileIsExecutable=/usr/local/sbin/cpsc-initd
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/cpsc-initd
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
In /usr/local/sbin/cpsc-initd:
#!/bin/sh
StartupDir="/usr/local/boot/startup"
# Run all scripts starting with 'S'
for i in `ls $StartupDir/S*` ; do
ScriptName=`basename $i`
sh $StartupDir/$ScriptName
done
# Success exit code.
exit 0
Make the directory:
mkdir -p /usr/local/boot/startup/
Then place your scripts in the startup directory starting with the letter 'S'.