init
This commit is contained in:
BIN
StartService/bin/start
Executable file
BIN
StartService/bin/start
Executable file
Binary file not shown.
5
StartService/bin/start.sh
Normal file
5
StartService/bin/start.sh
Normal 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
3
StartService/bin/stop.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
sudo systemctl stop fastApi.service
|
||||
|
||||
sudo systemctl stop pubimg.service
|
9
StartService/src/makefile
Normal file
9
StartService/src/makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
all:start
|
||||
|
||||
start:
|
||||
g++ -g -o start start.cpp
|
||||
|
||||
mv start ../bin
|
||||
|
||||
clean:
|
||||
rm -rf start
|
36
StartService/src/start.cpp
Normal file
36
StartService/src/start.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user