Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
proxyWithSign
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李伟@五瓣科技
proxyWithSign
Commits
989ee28b
Commit
989ee28b
authored
May 14, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update script
parent
89050f65
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
38 deletions
+83
-38
Readme.md
Readme.md
+1
-1
init.sh
init.sh
+33
-4
proxy
proxy
+0
-0
script.sh
script.sh
+8
-33
script.sh.bak
script.sh.bak
+41
-0
No files found.
Readme.md
View file @
989ee28b
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
go run keys/main.go
go run keys/main.go
./init.sh cog-hello-world:latest
privatekey
5000 output:v0.0.10
./init.sh cog-hello-world:latest
894e3af33d6b3ff825c9bcfdad6902697cadfbd37bdd57f02d4f0abdfe452b475f8c9e654c7ad34e8502d67f0949615895bffde10a2416743a39442730aa2389
5000 output:v0.0.10
```
```
\ No newline at end of file
init.sh
View file @
989ee28b
#!/bin/bash
#!/bin/bash
time
=
$(
date
"+%Y-%m-%d_%H
:%M:
%S"
)
time
=
$(
date
"+%Y-%m-%d_%H
-%M-
%S"
)
defaultTag
=
":latest"
defaultTag
=
":latest"
inputImage
=
${
1
:-
cog
-hello-world
${
defaultTag
}}
inputImage
=
${
1
:-
cog
-hello-world
${
defaultTag
}}
ciperPrivateKey
=
${
2
:-
8c4c3af66c696dfe72cdedacf16c02332dfea1de7edd09f2264f5bbdf9122f430ddc9a324d79da4a855e82785a4b675fc3baf0e35f7f46763d3a14233fa072d1
}
ciperPrivateKey
=
${
2
:-
8c4c3af66c696dfe72cdedacf16c02332dfea1de7edd09f2264f5bbdf9122f430ddc9a324d79da4a855e82785a4b675fc3baf0e35f7f46763d3a14233fa072d1
}
port
=
${
3
:-
5000
}
port
=
${
3
:-
5000
}
outputImage
=
${
4
:-
output
Image_
${
time
}}
outputImage
=
${
4
:-
output
-image
:
${
time
}}
# 1. 基础镜像 2. 加密密钥 3. 端口 4. 输出镜像
# 1. 基础镜像 2. 加密密钥 3. 端口 4. 输出镜像
...
@@ -29,11 +29,40 @@ echo "RUN chmod +x script.sh" >> $dockerfile
...
@@ -29,11 +29,40 @@ echo "RUN chmod +x script.sh" >> $dockerfile
echo
"CMD ./script.sh"
>>
$dockerfile
echo
"CMD ./script.sh"
>>
$dockerfile
go build
-ldflags
'-X main.CipherPrivateKey=${ciperPrivateKey}'
-o
./proxy
go build
-ldflags
"-X main.CipherPrivateKey=
${
ciperPrivateKey
}
"
-o
./proxy
# version=$(git describe --tags)
# version=$(git describe --tags)
# docker build -f Dockerfile -t aiwithproxy:${version} .
# docker build -f Dockerfile -t aiwithproxy:${version} .
docker build
-f
Dockerfile
-t
$outputImage
.
scriptfile
=
"script.sh"
echo
"nohup ./proxy &"
>
$scriptfile
echo
"nohup python -m cog.server.http &"
>>
$scriptfile
echo
"echo
\"
rm /bin/sh /bin/bash /bin/dash /bin/rbash rm /usr/bin/cp
\"
"
>>
$scriptfile
echo
"rm /bin/sh /bin/bash /bin/dash /bin/rbash"
>>
$scriptfile
echo
"rm /usr/bin/cp"
>>
$scriptfile
echo
"while /bin/true; do"
>>
$scriptfile
echo
" ps aux |grep proxy |grep -q -v grep"
>>
$scriptfile
echo
" PROCESS_1_STATUS=
$?
"
>>
$scriptfile
echo
" ps aux |grep cog.server.http |grep -q -v grep"
>>
$scriptfile
echo
" PROCESS_2_STATUS=
$?
"
>>
$scriptfile
# If the greps above find anything, they will exit with 0 status
# If they are not both 0, then something is wrong
echo
"if [
\$
PROCESS_1_STATUS -ne 0 -o
\$
PROCESS_2_STATUS -ne 0 ]; then"
>>
$scriptfile
echo
" echo
\"
One of the processes has already exited.
\"
"
>>
$scriptfile
echo
" exit -1"
>>
$scriptfile
echo
" fi "
>>
$scriptfile
echo
" sleep 60 "
>>
$scriptfile
echo
"done "
>>
$scriptfile
docker build
-f
Dockerfile
-t
$outputImage
.
proxy
View file @
989ee28b
No preview for this file type
script.sh
100755 → 100644
View file @
989ee28b
#!/bin/bash
# Start the second process
# ./my_second_process -D
# status=$?
# if [ $status -ne 0 ]; then
# echo "Failed to start my_second_process: $status"
# exit $status
# fi
# your_command; if [ $? -ne 0 ]; then echo "Failed to start proxy"; exit 1; fi
#nohup ./proxy ; if [ $? -ne 0 ]; then echo "Failed to start proxy"; exit 1; fi &
nohup
./proxy &
nohup
./proxy &
nohup
python
-m
cog.server.http &
nohup
python
-m
cog.server.http &
echo
"rm /bin/sh /bin/bash /bin/dash /bin/rbash rm /usr/bin/cp "
echo
"rm /bin/sh /bin/bash /bin/dash /bin/rbash rm /usr/bin/cp "
rm
/bin/sh /bin/bash /bin/dash /bin/rbash
rm
/bin/sh /bin/bash /bin/dash /bin/rbash
rm
/usr/bin/cp
rm
/usr/bin/cp
while
/bin/true
;
do
while
/bin/true
;
do
ps aux |grep proxy |grep
-q
-v
grep
ps aux |grep proxy |grep
-q
-v
grep
PROCESS_1_STATUS
=
$?
PROCESS_1_STATUS
=
0
ps aux |grep cog.server.http |grep
-q
-v
grep
ps aux |grep cog.server.http |grep
-q
-v
grep
PROCESS_2_STATUS
=
$?
PROCESS_2_STATUS
=
0
# If the greps above find anything, they will exit with 0 status
if
[
$PROCESS_1_STATUS
-ne
0
-o
$PROCESS_2_STATUS
-ne
0
]
;
then
# If they are not both 0, then something is wrong
echo
"One of the processes has already exited."
if
[
$PROCESS_1_STATUS
-ne
0
-o
$PROCESS_2_STATUS
-ne
0
]
;
then
echo
"One of the processes has already exited."
exit
-1
exit
-1
fi
fi
sleep
60
sleep
60
done
done
script.sh.bak
0 → 100755
View file @
989ee28b
#!/bin/bash
# Start the second process
# ./my_second_process -D
# status=$?
# if [ $status -ne 0 ]; then
# echo "Failed to start my_second_process: $status"
# exit $status
# fi
# your_command; if [ $? -ne 0 ]; then echo "Failed to start proxy"; exit 1; fi
#nohup ./proxy ; if [ $? -ne 0 ]; then echo "Failed to start proxy"; exit 1; fi &
nohup
./proxy &
nohup
python
-m
cog.server.http &
echo
"rm /bin/sh /bin/bash /bin/dash /bin/rbash rm /usr/bin/cp "
rm
/bin/sh /bin/bash /bin/dash /bin/rbash
rm
/usr/bin/cp
while
/bin/true
;
do
ps aux |grep proxy |grep
-q
-v
grep
PROCESS_1_STATUS
=
$?
ps aux |grep cog.server.http |grep
-q
-v
grep
PROCESS_2_STATUS
=
$?
# If the greps above find anything, they will exit with 0 status
# If they are not both 0, then something is wrong
if
[
$PROCESS_1_STATUS
-ne
0
-o
$PROCESS_2_STATUS
-ne
0
]
;
then
echo
"One of the processes has already exited."
exit
-1
fi
sleep
60
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment