Skip to content
Snippets Groups Projects
Commit 337f6b97 authored by Recolic's avatar Recolic :house_with_garden:
Browse files

.bugfix

parent 2fd2d55b
No related branches found
No related tags found
No related merge requests found
...@@ -16,23 +16,26 @@ function lc_bgrun () { ...@@ -16,23 +16,26 @@ function lc_bgrun () {
# Usage: lc_bgrun /var/log/your.log sslocal -s xxx -p 'hello world my password' -l xxx --xxx # Usage: lc_bgrun /var/log/your.log sslocal -s xxx -p 'hello world my password' -l xxx --xxx
# Usage: lc_bgrun /var/log/your.log auto_restart frpc -c my_server.ini # Usage: lc_bgrun /var/log/your.log auto_restart frpc -c my_server.ini
# Usage: lc_bgrun /dev/null every 1h curl https://example-ddns.com/api # Usage: lc_bgrun /dev/null every 1h curl https://example-ddns.com/api
# v202504-2 # v202504-3
local logF="$1" local logF="$1"
shift shift
local cmd="$1" local cmd="$1"
shift shift
local t=1 local t=1
local sync=1
if [ "$cmd" = every ]; then if [ "$cmd" = every ]; then
t="$1" t="$1"
sync=0
cmd=auto_restart cmd=auto_restart
shift
fi fi
if [ "$cmd" = auto_restart ] && [ ! -f /tmp/.auto_restart ]; then if [ "$cmd" = auto_restart ] && [ ! -f /tmp/.auto_restart ]; then
echo IyEvYmluL2Jhc2gKd2hpbGUgdHJ1ZTsgZG8KIiRAIgpbWyAkPyA9IDEzMCBdXSAmJiBicmVhawpzbGVlcCAiJHQiCmRvbmUK | base64 -d > /tmp/.auto_restart echo IyEvYmluL2Jhc2gKd2hpbGUgdHJ1ZTsgZG8KWyAkc3luYyA9IDEgXSAmJiAiJEAiClsgJHN5bmMgPSAwIF0gJiYgIiRAIiAmCnNsZWVwICIkdCIKZG9uZQo= | base64 -d > /tmp/.auto_restart
chmod ugo+rx /tmp/.auto_restart chmod ugo+rx /tmp/.auto_restart
cmd=/tmp/.auto_restart cmd=/tmp/.auto_restart
fi fi
echo "[$(date --utc)] EXEC $cmd $@" >> "$logF" echo "[$(date --utc)] EXEC $cmd $@" >> "$logF"
t="$t" nohup "$cmd" "$@" >> "$logF" 2>&1 & disown sync=$sync t="$t" nohup "$cmd" "$@" >> "$logF" 2>&1 & disown
return $? return $?
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment