Files
clash-for-linux-install/scripts/init/SysVinit.sh
T
libm 7f3612a26c refactor: support multiple init systems
- detect system architecture and init system
- download matching kernel and dependencies

fix #385, fix #384, fix #383, #382, fix #373, fix #307, fix #128, fix #118, fix #103, fix #91
2025-12-16 15:26:59 +08:00

45 lines
969 B
Bash
Executable File

### BEGIN INIT INFO
# Provides: placeholder_kernel_name
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: placeholder_kernel_desc
# Description: placeholder_kernel_desc
### END INIT INFO
pidfile="placeholder_pid_file"
logfile="placeholder_log_file"
cmd="placeholder_cmd_full"
case "$1" in
start)
$0 status >&/dev/null && exit 0
$cmd >&$logfile &
echo $! >$pidfile
;;
stop)
pid=$(cat $pidfile 2>/dev/null)
[ -n "$pid" ] && kill -9 "$pid"
rm -f $pidfile
;;
restart | reload)
$0 stop
sleep 0.5
$0 start
;;
status)
pid=$(cat $pidfile 2>/dev/null)
isStart=$(ps ax | awk '{ print $1 }' | grep -e "^${pid}$")
[ -n "$isStart" ] && {
echo "placeholder_kernel_name is running with PID: $pid"
exit 0
}
echo "placeholder_kernel_name is not running."
exit 1
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac