Lines 193-198
Link Here
|
193 |
|
193 |
|
194 |
# Create start, stop, restart and reload Gentoo compliant Webmin scripts |
194 |
# Create start, stop, restart and reload Gentoo compliant Webmin scripts |
195 |
# We use sys-apps/openrc functions which is already pulled by sys-apps/baselayout |
195 |
# We use sys-apps/openrc functions which is already pulled by sys-apps/baselayout |
|
|
196 |
# or systemctl if we run under systemd |
196 |
echo "Creating start and stop scripts.." |
197 |
echo "Creating start and stop scripts.." |
197 |
rm -f $config_dir/{start,stop,restart,reload} |
198 |
rm -f $config_dir/{start,stop,restart,reload} |
198 |
|
199 |
|
Lines 201-207
Link Here
|
201 |
#!/bin/sh |
202 |
#!/bin/sh |
202 |
|
203 |
|
203 |
if [ ! -f "${pidfile}" ]; then |
204 |
if [ ! -f "${pidfile}" ]; then |
204 |
rc-service --ifexists -- webmin start |
205 |
if [[ -d /run/systemd/system ]] ; then |
|
|
206 |
systemctl start webmin.service |
207 |
else |
208 |
rc-service --ifexists -- webmin start |
209 |
fi |
205 |
fi |
210 |
fi |
206 |
END |
211 |
END |
207 |
|
212 |
|
Lines 209-229
Link Here
|
209 |
cat <<END >>"$config_dir/stop" |
214 |
cat <<END >>"$config_dir/stop" |
210 |
#!/bin/sh |
215 |
#!/bin/sh |
211 |
|
216 |
|
212 |
rc-service --ifexists -- webmin --ifstarted stop |
217 |
if [[ -d /run/systemd/system ]] ; then |
|
|
218 |
systemctl stop webmin.service |
219 |
else |
220 |
rc-service --ifexists -- webmin --ifstarted stop |
221 |
fi |
213 |
END |
222 |
END |
214 |
|
223 |
|
215 |
# The restart script in /etc/webmin (Gentoo compliant) |
224 |
# The restart script in /etc/webmin (Gentoo compliant) |
216 |
cat <<END >>"$config_dir/restart" |
225 |
cat <<END >>"$config_dir/restart" |
217 |
#!/bin/sh |
226 |
#!/bin/sh |
218 |
|
227 |
|
219 |
rc-service --ifexists -- webmin --ifstarted restart |
228 |
if [[ -d /run/systemd/system ]] ; then |
|
|
229 |
systemctl try-restart webmin.service |
230 |
else |
231 |
rc-service --ifexists -- webmin --ifstarted restart |
232 |
fi |
220 |
END |
233 |
END |
221 |
|
234 |
|
222 |
# The reload script in /etc/webmin (Gentoo compliant) |
235 |
# The reload script in /etc/webmin (Gentoo compliant) |
223 |
cat <<END >>"$config_dir/reload" |
236 |
cat <<END >>"$config_dir/reload" |
224 |
#!/bin/sh |
237 |
#!/bin/sh |
225 |
|
238 |
|
226 |
rc-service --ifexists -- webmin --ifstarted reload |
239 |
if [[ -d /run/systemd/system ]] ; then |
|
|
240 |
systemctl reload-or-try-restart webmin.service |
241 |
else |
242 |
rc-service --ifexists -- webmin --ifstarted reload |
243 |
fi |
227 |
END |
244 |
END |
228 |
|
245 |
|
229 |
chmod 755 $config_dir/{start,stop,restart,reload} |
246 |
chmod 755 $config_dir/{start,stop,restart,reload} |