36 lines
748 B
C++
36 lines
748 B
C++
|
|
/*
|
||
|
|
本程序为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;
|
||
|
|
}
|