| Server IP : 82.208.35.60 / Your IP : 216.73.217.33 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/sysutils/dae/files/ |
Upload File : |
#!/bin/sh
###
# Author: Light
# Email: isibane@gmail.com
###
usage()
{
echo "Usage: `basename $0` [-a] | [-l] | [-L] | <service-name> [action]"
echo -e "\t-h Show this message"
echo -e "\t-a Show all service names"
echo -e "\t-l Show system service names"
echo -e "\t-L Show port service names"
echo -e "\t-x Show X11 service names"
exit 1
}
list_system() { find /etc/rc.d -type f -perm +a+x 2>/dev/null; }
list_ports() { find /usr/local/etc/rc.d -type f -perm +a+x 2>/dev/null; }
list_x11() { find /usr/X11R6/etc/rc.d -type f -perm +a+x 2>/dev/null; }
list_filter() { sed "s/.sh$//g;s/.*\\///g" | sort | column; }
set -- `getopt "ahlLx" "$@"` || {
usage
}
while :
do
case "$1" in
-a) ( list_system; list_ports; list_x11) | list_filter; exit 0 ;;
-l) list_system | list_filter; exit 0 ;;
-L) list_ports | list_filter; exit 0 ;;
-x) list_x11 | list_filter; exit 0 ;;
-h) usage ;;
--) break ;;
esac
shift
done
shift
if [ -z "$1" ]
then
usage
fi
service_name=`( list_system; list_ports; list_x11 ) | grep -e "/$1[^/]*$\|/$1[^/]*\.sh$" | head -n 1`
if [ -z "$service_name" ]
then
echo "Error: Unknown service '$1*[.sh]'"
echo
usage
else
$service_name $2
fi
exit 0