This commit is contained in:
2025-09-28 16:31:50 +08:00
parent 8587e5c84a
commit 0eb94c9e11
10 changed files with 171 additions and 2 deletions

BIN
StartService/bin/start Executable file

Binary file not shown.

View File

@@ -0,0 +1,5 @@
#开启pubimg.service
sudo systemctl start pubimg.service
#开启fastapi
sudo systemctl start fastApi.service

3
StartService/bin/stop.sh Normal file
View File

@@ -0,0 +1,3 @@
sudo systemctl stop fastApi.service
sudo systemctl stop pubimg.service

View File

@@ -0,0 +1,9 @@
all:start
start:
g++ -g -o start start.cpp
mv start ../bin
clean:
rm -rf start

View File

@@ -0,0 +1,36 @@
/*
本程序为BSD服务启动程序,主要用于进行BSD系统的服务启动
*/
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
if (argc != 2)
{
cout << "Using:./start start/stop" << endl;
return -1;
}
string commnd = "";
string action(argv[1]);
if (action == "start")
{
commnd = "echo 'orangepi' | sh /home/orangepi/RKApp/StartService/bin/start.sh";
}
else if(action == "stop")
{
commnd = "echo 'orangepi' | sh /home/orangepi/RKApp/StartService/bin/stop.sh";
}
else
{
cout << "Unknown action: " << action << "\nUsing: ./start start|stop" << endl;
return -1;
}
system(commnd.c_str());
return 0;
}