3 Commits 0c529419e6 ... 9d0f5ab98c

Autor SHA1 Nachricht Datum
  rosa 9d0f5ab98c Ignore signals vor 8 Jahren
  rosa 66088add15 Improve The log vor 8 Jahren
  rosa 299e491b6c Add make clean vor 8 Jahren
2 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
  1. 6 3
      f.c
  2. 1 0
      run.sh

+ 6 - 3
f.c

@@ -6,14 +6,15 @@
 #include <fcntl.h>
 #include <syslog.h>
 #include <unistd.h>
-
-main()
+int main(int argc, char *argv[])
 {
+ openlog(argv[0],LOG_NOWAIT|LOG_PID,LOG_USER);
  pid_t pid;
  pid = fork();
  /* If the pid is less than zero, something went wrong when forking */
  if (pid < 0) 
 {
+ syslog(LOG_NOTICE, "Cant Fork\n");
  exit(EXIT_FAILURE);
  }
  /* If the pid we got back was greater than zero, then the clone was successful and we are the parent. */ 
@@ -35,10 +36,12 @@ umask(0);
  close(STDIN_FILENO);
  close(STDOUT_FILENO);
  close(STDERR_FILENO);
+    //catch/ignore signals
+    signal(SIGCHLD,SIG_IGN);
+    signal(SIGHUP,SIG_IGN);
 
 /* Now we will tel the log server its ok now */
  /* Open a connection to the syslog server */
- openlog(argv[0],LOG_NOWAIT|LOG_PID,LOG_USER);
  /* Sends a message to the syslog daemon */
  syslog(LOG_NOTICE, "Successfully started daemon\n");
  closelog();

+ 1 - 0
run.sh

@@ -9,4 +9,5 @@ else
 echo $log1 >/tmp/q.txt
 make &>/tmp/q.tmp
 echo "this build log for "$log1|mutt -a /tmp/q.tmp -s "build log" -- blade.vp2020@gmail.com
+make clean
 fi