summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjjl2010-09-21 23:43:32 +0200
committerjjl2010-09-21 23:43:32 +0200
commitb6e32a987be01ccd0331dc1f75b55c7095cb4011 (patch)
tree76503734d369e3c2572597cf6c3decd8130c86d3
parentAll printf() replaced with qDebug() (diff)
downloadpvs-b6e32a987be01ccd0331dc1f75b55c7095cb4011.tar.gz
pvs-b6e32a987be01ccd0331dc1f75b55c7095cb4011.tar.xz
pvs-b6e32a987be01ccd0331dc1f75b55c7095cb4011.zip
pvsgui autostart
-rw-r--r--[-rwxr-xr-x]CMakeLists.txt1
-rw-r--r--misc/pvsgui.desktop3
-rw-r--r--[-rwxr-xr-x]src/pvsDaemon.cpp36
3 files changed, 8 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa4da6a..f53422e 100755..100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -368,6 +368,7 @@ ELSEIF(UNIX)
INSTALL( PROGRAMS misc/pvs-vncsrv DESTINATION bin)
INSTALL( FILES ${CMAKE_BINARY_DIR}/org.openslx.pvs.service DESTINATION share/dbus-1/services )
INSTALL( FILES misc/pvs.conf misc/pvsgui.conf misc/pvsmgr.conf DESTINATION /etc/openslx )
+ INSTALL( FILES misc/pvsgui.desktop DESTINATION /etc/xdg/autostart )
ENDIF(WIN32)
# add uninstall target to our makefile
diff --git a/misc/pvsgui.desktop b/misc/pvsgui.desktop
new file mode 100644
index 0000000..bb6408c
--- /dev/null
+++ b/misc/pvsgui.desktop
@@ -0,0 +1,3 @@
+[Desktop Entry]
+Exec=/usr/local/bin/pvsgui
+Type=Application
diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp
index cc11bd4..c975a9e 100755..100644
--- a/src/pvsDaemon.cpp
+++ b/src/pvsDaemon.cpp
@@ -61,7 +61,7 @@ void printCommands()
///
int main(int argc, char** argv)
{
- bool daemon = false;
+ bool _daemon = false;
int frequency = 5;
int port = -1;
@@ -141,7 +141,7 @@ int main(int argc, char** argv)
printVersion(true);
break;
case 'd':
- daemon = true;
+ _daemon = true;
break;
case 'c':
{
@@ -250,38 +250,10 @@ int main(int argc, char** argv)
ConsoleLog setLogName(QString("log.client"));
ConsoleLog writeLine(QString("PVS-Client started."));
- if (daemon)
+ if (_daemon)
{
#ifndef __WIN32__
- pid_t pid, sid; // our process ID and session ID
-
- // fork off the parent process
- pid = fork();
- if (pid < 0)
- exit(-1);
-
- // if we got a good PID, then we can exit the parent process.
- if (pid > 0)
- exit(0);
-
- // change the file mode mask
- umask(0);
-
- // create a new SID for the child process
- sid = setsid();
- if (sid < 0)
- exit(-1);
-
- // change the current working directory
- if ((chdir("/")) < 0)
- exit(-1);
-
- // close out the standard file descriptors
- close(STDIN_FILENO);
- freopen ((QString(getHomeDir()).append(QString("/.pvs/dump"))).toUtf8()
- .data(),"w",stdout);
- //close(STDOUT_FILENO);
- close(STDERR_FILENO);
+ daemon(1, 1);
#endif /*__WIN32__*/
}