Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bvtrach
Created March 20, 2014 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvtrach/9660738 to your computer and use it in GitHub Desktop.
Save bvtrach/9660738 to your computer and use it in GitHub Desktop.
#!/sbin/runscript
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
description="Executes user programs in /etc/local.d"
depend()
{
after *
keyword -timeout
}
start()
{
einfo "Starting extlocal"
local file
local path
if [ "${RC_SVCNAME}" = "extlocal" ]; then
path="/etc/local.d/${RC_RUNLEVEL}"
else
path="/etc/local.d/${RC_SVCNAME#*.}"
fi
einfo "Local service path: $path"
for file in $path/*.start ; do
[ -x "$file" ] && "$file"
done
if type local_start >/dev/null 2>&1; then
ewarn "/etc/conf.d/local should be removed."
ewarn "Please move the code from the local_start function"
ewarn "to scripts with an .start extension"
ewarn "in /etc/local.d"
local_start
fi
eend 0
}
stop()
{
einfo "Stopping extlocal"
local file
local path
if [ "${RC_SVCNAME}" = "extlocal" ]; then
path="/etc/local.d/${RC_RUNLEVEL}"
else
path="/etc/local.d/${RC_SVCNAME#*.}"
fi
einfo "Local service path: x$path"
for file in $path/*.stop; do
[ -x "$file" ] && "$file"
done
if type local_start >/dev/null 2>&1; then
ewarn "/etc/conf.d/local should be removed."
ewarn "Please move the code from the local_stop function"
ewarn "to scripts with an .stop extension"
ewarn "in /etc/local.d"
local_stop
fi
eend 0
}
# Local Variables:
# mode: sh
# End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment